Challenge

Project 1 (Mini Project on Vehicle Direction Detection

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

Objective of Mini Project:

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

Theory :

>> Vehicle Direction Determination:

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

Explanation :

As in quetion the signal list is given so as per the given data will create SLDD file y adding the given signals

Signals & Calibration Data List:

Signal / Calibration Name

Signal Type

Data Type

Dimension

Min

Max

Initial Value

Units

SteeringWheel_YawDegreeInput

Input

Int16

1

-180

180

-

Deg

CameraInput_RoadSign

Input

Boolean

1

0

1

-

-

Vehicle_Turn_Status

Local

Int16

1

-180

180

-

Deg

Right_Turn_AngularLimit

Calibration

Int16

[1 1]

-180

180

30

Deg

Left_Turn_AngularLimit

Calibration

Int16

[1 1]

-180

180

-120

Deg

Straight_Drive_Steering_Angle

Calibration

Int16

[1 1]

-180

180

0

Deg

RightTurn_RoadSign

Calibration

Int16

[1 1]

-180

180

30

LeftTurn_RoadSign

Calibration

Int16

[1 1]

-180

180

-120

Straight_RoadSign

Calibration

Int16

[1 1]

-180

180

0

Vehicle_Direction_Indicator

Output

Boolean

1

0

1

-

-

STEPS TO ADD THE SIGNALS IN SLDD FILE :

1.GO TO -MODELLING-LINK TO DATA DICTIONARY -

2. NEW FILE -CREATE FILE IN THE FOLDER WHERE YOU HAVE SAVE THE MOEL (CREATE ALL FILES IN SAME FOLDER )FOR BETTRE RESULT WITHOUT ERROR

3. now we have to add the signals as we are going to generate the code there is condition given in question as follows

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

we add the changes as per the given conditing

ITS VERY IMPORTANT TO SAVE THE CHANGES IF WE GO BACK THIS SIGNALS WILL NOT SAVED UNLESS UNTIL WE SAVE THEM.

4. ADD THE BLOCKS AS PER THE REQUIRMENT AND MAKES A SEPARTE SUBSYSTEMS OF BOTH REQUIRMENT

Objective of Mini Project:

as per the given requirment 1 we create the model 1:

as per the given requirment 2 we create the model :

  1. Tag the requirements to the simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.

STEPS TO TAG THE REQUIRMENT :

RIGHT CLICK ON SUSBSYSTEM-REQUIRMENT-LINK TO SELECTION IN WORD (FIRST OPEN THE WORD FILE COPY THE REQUIREMENT FROM THE QUESTION AND SELECT THE REQUIRMENT 1 AND FOLOOW THE PROCEDURE .

after tagging you can check its tagged or not its shwoing like this means we tagged the requirment 1

select the question or requirmnet from the word and follow the same procedure to tag requirment 2:

as its showing that subsystem is tagged with requirement:

  1. MBD compliant changes, Data Dictionary creation & code generation is added advantage, and that is not scope of this project.

as part of MBD compliant we are now giving all bloack names and labellingg of blocks

we are following some steps to give the all block names

select all blocks -right click-format-show block name -on .it will show the all block names

for giving the signal names we are labelling the all labesl :

select the signal line-right click-paste the signal name or write the signal name if it is the first signal -click on -signal name must be resolve so that its cme as main signal

here after completeing labelling it will show the resolved signal with propagated signals

TO GENERATE THE CODES : RIGHT CLICK-BLOCK PARAMETER -CLICK ON TREAT AS ATOAMTIC UNIT

CLICK ON TREAT AS ATOAMTIC UNIT

TO GENERATE THE CODE GO TO APPS-EMBEDDED C -GENERATE CODE

REPORT:

GENERATED C CODE .

File: MINI_PROJECT.c

1 /*
2 * File: MINI_PROJECT.c
3 *
4 * Code generated for Simulink model 'MINI_PROJECT'.
5 *
6 * Model version : 1.10
7 * Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
8 * C/C++ source code generated on : Wed Aug 17 00:00:56 2022
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: Intel->x86-64 (Windows64)
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16 #include "MINI_PROJECT.h"
17 #include "MINI_PROJECT_private.h"
18
19 /* Exported data definition */
20
21 /* Const memory section */
22 /* Definition for custom storage class: Const */
23 const int16_T LeftTurn_RoadSign = -120;/* Referenced by: '<S3>/Constant1' */
24 const int16_T Left_Turn_AngularLimit = -120;/* Referenced by: '<S2>/Constant' */
25 const int16_T RightTurn_RoadSign = 30; /* Referenced by: '<S3>/Constant' */
26 const int16_T Right_Turn_AngularLimit = 30;/* Referenced by: '<S2>/Constant1' */
27 const int16_T Straight_Drive_Steering_Angle = 0;/* Referenced by: '<S2>/Constant2' */
28 const int16_T Straight_RoadSign = 0; /* Referenced by: '<S3>/Constant2' */
29
30 /* External outputs (root outports fed by signals with default storage) */
31 ExtY_MINI_PROJECT_T MINI_PROJECT_Y;
32
33 /* Real-time model */
34 static RT_MODEL_MINI_PROJECT_T MINI_PROJECT_M_;
35 RT_MODEL_MINI_PROJECT_T *const MINI_PROJECT_M = &MINI_PROJECT_M_;
36
37 /* Model step function */
38 void MINI_PROJECT_step(void)
39 {
40 /* local block i/o variables */
41 int16_T Vehicle_Turn_Status;
42
43 /* Outputs for Atomic SubSystem: '<Root>/Subsystem2' */
44 /* Switch: '<S2>/Switch1' incorporates:
45 * Inport: '<Root>/SteeringWheel_YawDegreeInput'
46 * Switch: '<S2>/Switch'
47 */
48 if (SteeringWheel_YawDegreeInput > 0) {
49 /* Switch: '<S2>/Switch1' incorporates:
50 * Constant: '<S2>/Constant1'
51 */
52 Vehicle_Turn_Status = Right_Turn_AngularLimit;
53 } else if (SteeringWheel_YawDegreeInput > 0) {
54 /* Switch: '<S2>/Switch' incorporates:
55 * Constant: '<S2>/Constant'
56 * Switch: '<S2>/Switch1'
57 */
58 Vehicle_Turn_Status = Left_Turn_AngularLimit;
59 } else {
60 /* Switch: '<S2>/Switch1' incorporates:
61 * Constant: '<S2>/Constant2'
62 * Switch: '<S2>/Switch'
63 */
64 Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
65 }
66
67 /* End of Switch: '<S2>/Switch1' */
68
69 /* Outport: '<Root>/ Vehicle_Direction_Indicator' incorporates:
70 * Constant: '<S3>/Constant'
71 * Constant: '<S3>/Constant1'
72 * Constant: '<S3>/Constant2'
73 * Inport: '<Root>/CameraInput_RoadSign'
74 * Logic: '<S3>/AND'
75 * Logic: '<S3>/AND1'
76 * Logic: '<S3>/AND2'
77 * RelationalOperator: '<S3>/Equal'
78 * RelationalOperator: '<S3>/Equal1'
79 * RelationalOperator: '<S3>/Equal2'
80 */
81 MINI_PROJECT_Y.Vehicle_Direction_Indicator[0] = ((Vehicle_Turn_Status ==
82 RightTurn_RoadSign) && CameraInput_RoadSign);
83 MINI_PROJECT_Y.Vehicle_Direction_Indicator[1] = ((Vehicle_Turn_Status ==
84 LeftTurn_RoadSign) && CameraInput_RoadSign);
85 MINI_PROJECT_Y.Vehicle_Direction_Indicator[2] = ((Vehicle_Turn_Status ==
86 Straight_RoadSign) && CameraInput_RoadSign);
87
88 /* End of Outputs for SubSystem: '<Root>/Subsystem2' */
89 }
90
91 /* Model initialize function */
92 void MINI_PROJECT_initialize(void)
93 {
94 /* (no initialization code required) */
95 }
96
97 /* Model terminate function */
98 void MINI_PROJECT_terminate(void)
99 {
100 /* (no terminate code required) */
101 }
102
103 /*
104 * File trailer for generated code.
105 *
106 * [EOF]
107 */
108
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.