Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Ev-BATCH-17

Aim: To develop the Vehicle Direction Determination model using simulink.

Objective of Mini Project:

  1. we Development of MATLAB Simulink model as per requirement.
  2. Tag the requirements to the simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.
  3. MBD compliant changes, Data Dictionary creation & code generation is added advantage, and that is not scope of this project.
  4. If choosing code generation, Storage class for Input signals: ImportedExtern; Storage class for Output signal: Export to File; Storage class for local signals: localizable; Storage class for calibration signals: Const.
  5. Choose sample time for all signals as 0.01s

General Overview:

  • Identifying the direction of the vehicle is one of the important & diverse features in Autonomous driving & Advanced Driver Assistance Features.
  • This particular sub-feature of identifying the direction of vehicle is basically identifying the direction the vehicle is taking based on the camera input.
  • Camera reads the road signs & stores into its memory with unique values for left turn, right turn & straight drive. Depending on the direction it is taking, final indication is given to the driver as an indication if he is driving in the recommended direction or not.
  • Vehicle Direction Determination can also be coupled along side features like GPS systems to identify whether the vehicle is reaching its destination in an optimized manner.
  • This sub feature can also be used along with Lane Detection, Highway Warning, Ramp Entry / Exit in Wrong Way Detection etc.

General steps:

1. open the Matlab page in that create the folder as Modelbase_miniproject and save. then we have to check weather the folder and file having the correct path have to check.

2. Then in matlab page select the simulink model and in that select the blank model to be create.

3. In that blank model first we have to save the model with modelbase_miniproject1.

4. Then after select the modelling tab and in that select the modelling setting option.

5. in model setting opition select the solver opition and in that solver selection select the fixed type and solver as discrete and in solver deatils fixed -step size is set as 0.01 and select the apply option and save it. which is shown in below.

6.Next in the same configuration parameters for the Embeded code geneartion select the system target file is to browse ert.tlc and select apply option and select ok. which is shown below.

7. After that we have to create the SLLD file. for that we have to select the modeling opition and in that select the link to dictonary file and which are shown below.

.

8. Then here we have to enter the SLLD file name and save in it as shown below.

9. After created SLLD file again select model explorer in that we have to select the extrenal data in that design data file to Open.

in that file enter the all signals and parameters and constants and set the size, value, DATA type,complexitiy, min,max values , and storage class as per the given data.

after the enter the all signals and there parameters save the files and this file is shown below.

Development of MATLAB Simulink model as per requirement.

Simulink Model:

create the Vehicle Direction Determination model in that we have to creat the subsystem and in that we are created two sub systems for requirement1 and requirement2 which is shown below.

Requirement - 1:

  • Steering wheel input as yaw rate (Signal name: SteeringWheel_YawDegreeInput) is the input for this system.
  • This is compared against 3 angular values, one each for left turn, right turn & straight drive (Calibration Values: Right_Turn_AngularLimit, Left_Turn_AngularLimit, Straight_Drive_Steering_Angle) to say which specific direction the steering wheel is turning towards.
  • Use switch blocks to compare & develop this requirement. Keep this requirement in a subsystem & output of this requirement is a local signal (Signal Name: Vehicle_Turn_Status).
  • The requirements 1 subsytem internal connection and blocks are connections are shown below.

Requirement – 2:

  • Keep this requirement as a separate subsystem. Inputs to this requirement are local signal from requirement 1 (Signal Name: Vehicle_Turn_Status) & an input signal from camera (Signal Name: CameraInput_RoadSign), which confirms the occurrence of a road sign.
  • Signal Vehicle_Turn_Status is compared against calibration values (Calibration Values: RightTurn_RoadSign, LeftTurn_RoadSign, Straight_RoadSign), if each of them is found equal, then each of the three corresponding output is compared against the camera input signal,
  • Using a logical operator block, only one among them is finally given as output signal (Signal Name: Vehicle_Direction_Indicator).
  • requirements 2 subsystem and its bocks connections are shown below.

After that we have to create the requirements 1&2 are linked with the word documents for the future reffereing. By right click on the subsystem and in that we have to select the requriements to select the link to word option. and which is shown below.

10. select the model explorer and in that we have to select the model advisor toll in that select the task by in that select model Standards for MAB and run the model.

then its shown some warnings and error after run . clear the filed errors and clear the warnings less as possible and after that generate the report the of the file asshown below.

after that complete corrections of errors and warnings generated report is saved in the correct folder in correct file as shown below.

11. vehicle direction determination block we have to create the MIL and SIL test for that we have to create the test harness model for the main model

Here we are create the test harness for the main system by right click on sysytem and select test harness and inthat select create for subsystem as shown below.

after create the test harness block select input as signal builder and source as the output which are shown below.

after that MIL test harness is created which are shown below.

in that signal builder import the test cases file from the floder then after input waveforms as shown below.

after given test cases mil test susbsystem and its connection for comparing the input and output and the difference between input and output are shown in scope1 and scope whih are shown below.

output results:

compare the input and output signals of signal builder and output of the demux as shown below.

output signal of the demux which are shown below.

for create test harness for SIL test we have change the design verfier to enable the treat Atomic unit.

inthat block we have to enable the treat as atomic unit as shown below.

after that we are create that test harness and in that input is select is signal builder and output is outpt only as shown below.

here we are select the verfication mode we have to select the software in the loop as shown below.

after given test cases sil test susbsystem and its connection for comparing the input and output and the difference between input and output are shown in scope1 and scope whih are shown below.

output:

output results of the demux froem the sil test as shown below.

output :

in that difference between the input and output signals are shown below .

here we are create the c code generation perpose

select app and in that embedded code then in that code select and select the build option which shown below.

after generate the code and save the code in the in the save floder which is are shown below.

Generated code:

/*
* Academic License - for use in teaching, academic research, and meeting
* course requirements at degree granting institutions only. Not for
* government, commercial, or other organizational use.
*
* File: mbdminiproject_1.c
*
* Code generated for Simulink model 'mbdminiproject_1'.
*
* Model version : 1.10
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Tue Jun 28 17:22:01 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "mbdminiproject_1.h"
#include "rtwtypes.h"
#include "mbdminiproject_1_private.h"
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
boolean_T Vehicle_Direction_Indicator[3];/* '/Signal Copy' */
/* Const memory section */
/* Definition for custom storage class: Const */
const int16_T LeftTurn_RoadSign = -120;/* Referenced by: '/Constant1' */
const int16_T Left_Turn_AngularLimit = -120;/* Referenced by: '/Constant2' */
const int16_T RightTurn_RoadSign = 30; /* Referenced by: '/Constant' */
const int16_T Right_Turn_AngularLimit = 30;/* Referenced by: '/Constant' */
const int16_T Straight_Drive_Steering_Angle = 0;/* Referenced by: '/Constant1' */
const int16_T Straight_RoadSign = 0; /* Referenced by: '/Constant2' */
/* Real-time model */
static RT_MODEL_mbdminiproject_1_T mbdminiproject_1_M_;
RT_MODEL_mbdminiproject_1_T *const mbdminiproject_1_M = &mbdminiproject_1_M_;
/* Model step function */
void mbdminiproject_1_step(void)
{
/* local block i/o variables */
int16_T Vehicle_Turn_Status;
/* Switch: '/Switch1' incorporates:
* Constant: '/Constant'
* Constant: '/Constant'
* Inport: '/SteeringWheel_YawDegreeInput '
* RelationalOperator: '/Compare'
* RelationalOperator: '/Compare'
* Switch: '/Switch'
*/
if (SteeringWheel_YawDegreeInput > 0) {
/* Switch: '/Switch1' incorporates:
* Constant: '/Constant'
*/
Vehicle_Turn_Status = Right_Turn_AngularLimit;
} else if (SteeringWheel_YawDegreeInput == 0) {
/* Switch: '/Switch' incorporates:
* Constant: '/Constant1'
* Switch: '/Switch1'
*/
Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
} else {
/* Switch: '/Switch1' incorporates:
* Constant: '/Constant2'
* Switch: '/Switch'
*/
Vehicle_Turn_Status = Left_Turn_AngularLimit;
}
/* End of Switch: '/Switch1' */
/* SignalConversion: '/Signal Copy' incorporates:
* Constant: '/Constant'
* Constant: '/Constant1'
* Constant: '/Constant2'
* Inport: '/CameraInput_RoadSign '
* Logic: '/Logical Operator'
* Logic: '/Logical Operator1'
* Logic: '/Logical Operator2'
* RelationalOperator: '/Relational Operator'
* RelationalOperator: '/Relational Operator1'
* RelationalOperator: '/Relational Operator2'
*/
Vehicle_Direction_Indicator[0] = ((Vehicle_Turn_Status == RightTurn_RoadSign) &&
CameraInput_RoadSign);
Vehicle_Direction_Indicator[1] = ((Vehicle_Turn_Status == LeftTurn_RoadSign) &&
CameraInput_RoadSign);
Vehicle_Direction_Indicator[2] = ((Vehicle_Turn_Status == Straight_RoadSign) &&
CameraInput_RoadSign);
}
/* Model initialize function */
void mbdminiproject_1_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void mbdminiproject_1_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
concusion:
  • we Developed the of MATLAB Simulink model as per requirement.
  • Tag the requirements to the simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.
  • MBD compliant changes, Data Dictionary creation & code generation is added advantage, and that is not scope of this project.
  • If choosing code generation, Storage class for Input signals: ImportedExtern; Storage class for Output signal: Export to File; Storage class for local signals: localizable; Storage class for calibration signals: Const.
  • Choose sample time for all signals as 0.01s
  • all required documents are attached below
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.