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.

SOLUTION

Here the given question was solved using the matlab Simulink 

The given data using we created the SLDD for the model we developed in the Traffic jam assistance sysytem.

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

AS per the given data the sldd was

After crreating the Sldd tthe main model for Traffic jam assistance was created using the data was provided

inside the main model we split in to two requriements

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

After that creation the model advisory coverage check was performed

After that Auto code generation was done and the output are

Traffic jam Assistance .c

/*

 * Event Support License -- for demonstration use and event support.  Not

 * for government, research, commercial, or other organizational use.

 *

 * File: TRAFFIC_JAM_ASSITANCE.h

 *

 * Code generated for Simulink model 'TRAFFIC_JAM_ASSITANCE'.

 *

 * Model version                  : 1.6

 * Simulink Coder version         : 9.7 (R2022a) 13-Nov-2021

 * C/C++ source code generated on : Fri May  5 15:38:20 2023

 *

 * Target selection: ert.tlc

 * Embedded hardware selection: Intel->x86-64 (Windows64)

 * Code generation objectives: Unspecified

 * Validation result: Not run

 */

#ifndef RTW_HEADER_TRAFFIC_JAM_ASSITANCE_h_

#define RTW_HEADER_TRAFFIC_JAM_ASSITANCE_h_

#ifndef TRAFFIC_JAM_ASSITANCE_COMMON_INCLUDES_

#define TRAFFIC_JAM_ASSITANCE_COMMON_INCLUDES_

#include "rtwtypes.h"

#endif                              /* TRAFFIC_JAM_ASSITANCE_COMMON_INCLUDES_ */

#include "TRAFFIC_JAM_ASSITANCE_types.h"

/* Macros for accessing real-time model data structure */

#ifndef rtmGetErrorStatus

#define rtmGetErrorStatus(rtm)         ((rtm)->errorStatus)

#endif

#ifndef rtmSetErrorStatus

#define rtmSetErrorStatus(rtm, val)    ((rtm)->errorStatus = (val))

#endif

/* Block signals (default storage) */

typedef struct {

  uint8_T Optimum_Voltage;             /* '/Merge' */

} B_TRAFFIC_JAM_ASSITANCE_T;

/* Invariant block signals (default storage) */

typedef struct {

  const boolean_T AND1;                /* '/AND1' */

} ConstB_TRAFFIC_JAM_ASSITANCE_T;

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

typedef struct {

  boolean_T Input_Switch;              /* '/Input_Switch' */

  uint8_T Enable_Display;              /* '/Enable_Display' */

  uint8_T Input_Voltage;               /* '/Input_Voltage' */

} ExtU_TRAFFIC_JAM_ASSITANCE_T;

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

typedef struct {

  uint8_T Output_Display;              /* '/Output_Display' */

} ExtY_TRAFFIC_JAM_ASSITANCE_T;

/* Real-time Model Data Structure */

struct tag_RTM_TRAFFIC_JAM_ASSITANCE_T {

  const char_T * volatile errorStatus;

};

/* Block signals (default storage) */

extern B_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_B;

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

extern ExtU_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_U;

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

extern ExtY_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_Y;

extern const ConstB_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_ConstB;/* constant block i/o */

/* Model entry point functions */

extern void TRAFFIC_JAM_ASSITANCE_initialize(void);

extern void TRAFFIC_JAM_ASSITANCE_step(void);

extern void TRAFFIC_JAM_ASSITANCE_terminate(void);

/* Real-time Model object */

extern RT_MODEL_TRAFFIC_JAM_ASSITANC_T *const TRAFFIC_JAM_ASSITANCE_M;

/*-

 * The generated code includes comments that allow you to trace directly

 * back to the appropriate location in the model.  The basic format

 * is /block_name, where system is the system number (uniquely

 * assigned by Simulink) and block_name is the name of the block.

 *

 * Use the MATLAB hilite_system command to trace the generated code back

 * to the model.  For example,

 *

 * hilite_system('')    - opens system 3

 * hilite_system('/Kp') - opens and selects block Kp which resides in S3

 *

 * Here is the system hierarchy for this model

 *

 * '' : 'TRAFFIC_JAM_ASSITANCE'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_1'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_2'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_1/If Action Subsystem'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_1/If Action Subsystem1'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_2/Interruput_Block'

 * ''   : 'TRAFFIC_JAM_ASSITANCE/Traffic_Jam_Assis/Requrirement_2/Multiport_Switch_Block'

 */

#endif                                 /* RTW_HEADER_TRAFFIC_JAM_ASSITANCE_h_ */

/*

 * File trailer for generated code.

 *

 * [EOF]

 */

Traffic jam Assistance .h

/*

 * Event Support License -- for demonstration use and event support.  Not

 * for government, research, commercial, or other organizational use.

 *

 * File: TRAFFIC_JAM_ASSITANCE.c

 *

 * Code generated for Simulink model 'TRAFFIC_JAM_ASSITANCE'.

 *

 * Model version                  : 1.6

 * Simulink Coder version         : 9.7 (R2022a) 13-Nov-2021

 * C/C++ source code generated on : Fri May  5 15:38:20 2023

 *

 * Target selection: ert.tlc

 * Embedded hardware selection: Intel->x86-64 (Windows64)

 * Code generation objectives: Unspecified

 * Validation result: Not run

 */

#include "TRAFFIC_JAM_ASSITANCE.h"

#include "rtwtypes.h"

/* Block signals (default storage) */

B_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_B;

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

ExtU_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_U;

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

ExtY_TRAFFIC_JAM_ASSITANCE_T TRAFFIC_JAM_ASSITANCE_Y;

/* Real-time model */

static RT_MODEL_TRAFFIC_JAM_ASSITANC_T TRAFFIC_JAM_ASSITANCE_M_;

RT_MODEL_TRAFFIC_JAM_ASSITANC_T *const TRAFFIC_JAM_ASSITANCE_M =

  &TRAFFIC_JAM_ASSITANCE_M_;

/* Model step function */

void TRAFFIC_JAM_ASSITANCE_step(void)

{

  /* If: '/If' incorporates:

   *  Inport: '/Input_Voltage'

   */

  if (TRAFFIC_JAM_ASSITANCE_U.Input_Voltage <= 30) {

    /* Outputs for IfAction SubSystem: '/If Action Subsystem' incorporates:

     *  ActionPort: '/Action Port'

     */

    /* Merge: '/Merge' incorporates:

     *  Constant: '/Constant1'

     *  SignalConversion generated from: '/In1'

     */

    TRAFFIC_JAM_ASSITANCE_B.Optimum_Voltage = 30U;

    /* End of Outputs for SubSystem: '/If Action Subsystem' */

  } else if ((TRAFFIC_JAM_ASSITANCE_U.Input_Voltage > 30) &&

             (TRAFFIC_JAM_ASSITANCE_U.Input_Voltage <= 50)) {

    /* Outputs for IfAction SubSystem: '/If Action Subsystem1' incorporates:

     *  ActionPort: '/Action Port'

     */

    /* Merge: '/Merge' incorporates:

     *  Constant: '/Constant2'

     *  SignalConversion generated from: '/In1'

     */

    TRAFFIC_JAM_ASSITANCE_B.Optimum_Voltage = 50U;

    /* End of Outputs for SubSystem: '/If Action Subsystem1' */

  }

  /* End of If: '/If' */

  /* Switch: '/Switch' incorporates:

   *  DataTypeConversion: '/Data Type Conversion'

   *  Inport: '/Input_Switch'

   *  Logic: '/AND'

   *  Logic: '/NOT'

   */

  if (TRAFFIC_JAM_ASSITANCE_ConstB.AND1 &&

      (TRAFFIC_JAM_ASSITANCE_B.Optimum_Voltage != 0) &&

      (!TRAFFIC_JAM_ASSITANCE_U.Input_Switch)) {

    uint8_T tmp;

    /* Saturate: '/Saturation' incorporates:

     *  Inport: '/Enable_Display'

     */

    if (TRAFFIC_JAM_ASSITANCE_U.Enable_Display <= 7) {

      tmp = TRAFFIC_JAM_ASSITANCE_U.Enable_Display;

    } else {

      tmp = 7U;

    }

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

    /* MultiPortSwitch: '/Multiport Switch' */

    switch (tmp) {

     case 1:

      /* Outport: '/Output_Display' incorporates:

       *  Constant: '/Constant'

       */

      TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 1U;

      break;

     case 2:

      /* Outport: '/Output_Display' incorporates:

       *  Constant: '/Constant'

       */

      TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 1U;

      break;

     case 3:

      /* Outport: '/Output_Display' incorporates:

       *  Constant: '/Constant1'

       */

      TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 2U;

      break;

     case 4:

      /* Outport: '/Output_Display' incorporates:

       *  Constant: '/Constant1'

       */

      TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 2U;

      break;

     default:

      /* Outport: '/Output_Display' incorporates:

       *  Constant: '/Constant2'

       */

      TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 3U;

      break;

    }

    /* End of MultiPortSwitch: '/Multiport Switch' */

  } else {

    /* Outport: '/Output_Display' incorporates:

     *  Constant: '/Constant'

     */

    TRAFFIC_JAM_ASSITANCE_Y.Output_Display = 0U;

  }

  /* End of Switch: '/Switch' */

}

/* Model initialize function */

void TRAFFIC_JAM_ASSITANCE_initialize(void)

{

  /* (no initialization code required) */

}

/* Model terminate function */

void TRAFFIC_JAM_ASSITANCE_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.