Challenge

Project 1- Traffic Jam Assistant Feature

Aim of the project

To create a MATLAB model, Model advisor Check report and Code generation of Traffic_Jam_Assistant Feature based on the requirement

Objective of the project

The 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 model & must be linked to the model.

Model advisor report is mandatory & this will be followed by code generation

Introduction of Traffic Jam Assistant feature

Traffic jam assistant is one of the most common feature in ADAS. It 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 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 bassed on the sensor and functionality of Adaptive cruise Control (ACC) with stop & go and lane keeping Support (LKS). When ACC Stop and Go is turned on, the traffic jam assistant is continuously analysing the speed of the surrounding vehicle and compares it with the 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 the 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).

MATLAB MODEL is shown below

Three inputs such as Input_Voltage,Input_Switch and Enable_Display are given to the subsystem Traffic_jam_assistant based on the requirement and output is coming from the subsystem Named as Output_Display.

In the subsystem ’Traffic_Jam_Assistant’ the input voltage must be in between or equal to the value of volage maximum range or voltage minimum range if the condition satisfied it will renamed as Optimum voltage and the other inputs such as Input_Switch and Enable_display is connected to another subsystem Display_Unit .

Inner view of Subsystem Traffic_Jam_Assistant is shown below

In the Display unit the Enable_Display input is connected to the saturation block to saturate the value in between 0 to seven. Then it is given to the control Port of the Multiport switch. The one and two port are connected to the Calibration Signal ON_Mode, The three and four ports are connected to the Calibration signal OFF_MODE and the fifth one is connected with the STANBY_MODE,The output of the multiport switch is connected to another switch’s first input port.the third input port of the switch is connected to the calibration signal NO_DISPLAY.The not value of the 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 second input of the switch block and the output of the switch block is ‘Output_Display’

Inner view of the Subsystem Display_Unit is shown below

Sldd created is shown below

SLDD file is linked with the model and proceeded the model advisor check

Model Advisor Check

To do the model advisor check have to click on model advisor option under the Modelling and then have to select the MATLAB model to cover all as shown below

After selecting the system, MAB standards are selected for model advisor check

Screenshot of Model advisor report is shown below

Code Generation

Configuration settings made for code generation is shown below

After the configuration settings done have to click on App in the File option and have to select Embedded coder to get build option in the build option have to select generate code as shown below

then

Then the system starts to generate code

Generated code is attached

Traffic_Jam_Assistant_System.c

/*

* File: Traffic_Jam_Assistant_System.c

*

* Code generated for Simulink model 'Traffic_Jam_Assistant_System'.

*

* Model version : 1.1

* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019

* C/C++ source code generated on : Wed Nov 24 11:14:00 2021

*

* Target selection: ert.tlc

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

* Code generation objectives: Unspecified

* Validation result: Not run

*/

#include "Traffic_Jam_Assistant_System.h"

#include "Traffic_Jam_Assistant_System_private.h"

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

ExtU_Traffic_Jam_Assistant_Sy_T Traffic_Jam_Assistant_System_U;

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

ExtY_Traffic_Jam_Assistant_Sy_T Traffic_Jam_Assistant_System_Y;

/* Real-time model */

RT_MODEL_Traffic_Jam_Assistan_T Traffic_Jam_Assistant_System_M_;

RT_MODEL_Traffic_Jam_Assistan_T *const Traffic_Jam_Assistant_System_M =

&Traffic_Jam_Assistant_System_M_;

/* Model step function */

void Traffic_Jam_Assistant_System_step(void)

{

uint8_T rtb_MultiportSwitch;

/* Switch: '<S2>/Switch' incorporates:

* Inport: '<Root>/Input_Switch'

* Logic: '<S2>/AND1'

* Logic: '<S2>/NOT'

*/

if ((!Traffic_Jam_Assistant_System_U.Input_Switch) &&

Traffic_Jam_Assistant_Sy_ConstB.Equal) {

/* Saturate: '<S2>/Saturation' incorporates:

* Inport: '<Root>/Enable_Display'

*/

if (Traffic_Jam_Assistant_System_U.Enable_Display < 7) {

rtb_MultiportSwitch = Traffic_Jam_Assistant_System_U.Enable_Display;

} else {

rtb_MultiportSwitch = 7U;

}

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

/* MultiPortSwitch: '<S2>/Multiport Switch' incorporates:

* Constant: '<S2>/Constant'

* Constant: '<S2>/Constant1'

* Constant: '<S2>/Constant2'

*/

switch (rtb_MultiportSwitch) {

case 1:

rtb_MultiportSwitch = 1U;

break;

case 2:

rtb_MultiportSwitch = 1U;

break;

case 3:

rtb_MultiportSwitch = 2U;

break;

case 4:

rtb_MultiportSwitch = 2U;

break;

default:

rtb_MultiportSwitch = 3U;

break;

}

/* End of MultiPortSwitch: '<S2>/Multiport Switch' */

/* Outport: '<Root>/Output_Display' */

Traffic_Jam_Assistant_System_Y.Output_Display = rtb_MultiportSwitch;

} else {

/* Outport: '<Root>/Output_Display' incorporates:

* Constant: '<S2>/Constant3'

*/

Traffic_Jam_Assistant_System_Y.Output_Display = 0.0;

}

/* End of Switch: '<S2>/Switch' */

}

/* Model initialize function */

void Traffic_Jam_Assistant_System_initialize(void)

{

/* (no initialization code required) */

}

/* Model terminate function */

void Traffic_Jam_Assistant_System_terminate(void)

{

/* (no terminate code required) */

}

/*

* File trailer for generated code.

*

* [EOF]

*/

link for code https://drive.google.com/file/d/1-gho_DidRDOnOdKgOItH7W0mutD_JNyV/view?usp=sharing

Conclusion

Traffic Jam Assistant Model is created and its code is generated and Model Advisor check is done successfully

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.