Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Vehicle Direction Determination :

Aim of the Project:

  1. Develop a Simulink model (ADAS Feature) for given requirement Vehicle direction determination as
  2. Tag the requirements to the Simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems.
  3. Create a Simulink Data Dictionary(SLDD) and link with created Simulink model and also generate C code for the created Simulink model would be better
  4. While choosing the code generation, Need to 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 the solver setting as sample time for all signals as 0.01s

Solution :

As per the given 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 & the output of this requirement is a local signal (Signal Name: Vehicle_Turn_Status).

REQUIREMENT MODEL-1 :

Description of Requirement-1 :

  • Steering wheel Rotation (SteeringWheel_YawDegree) is the input to the system and it will be compared using switch blocks with the 3 angular values i.e.(Calibration Values: Right_Turn_AngularLimit, Left_Turn_AngularLimit, Straight_Drive_Steering_Angle) and the output of requirement-1 will be called as local signal (Vehicle_Turn_Status)
  • We have SteeringWheel_YawDegreeInput as the Input with 3 constant blocks and 2 switch blocks in this Subsystem. The parameter of constant blocks are feed by us from the Data list given to us
  • If the Input is equal or above 30 Right_Turn_Angular Limit will be passed on by 'Switch'. If the Input lies between -120 to 30, 'Switch1' and 'Switch' will pass Straight_Drive_Steering_Angle as the Output. If the Input is lesser than -120, Left_Turn_AngularLimit will be passed on.
  • The output of this Subsystem will be Vehicle_Turn_Status.

As per the 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).

REQUIREMENT - 2 MODEL DESIGN :

Description of Requirement Model-2 :

  • We have two inputs signals in Subsystem_2 , i.e.(Vehicle_Turn_Status and CameraInput_RoadSign).
  • (a)The output of Subsystem_1(Vehicle_Turn_Status) will be the Input to Subsystem_2
  • (b) another one is input from Camera input (CameraInput_RoadSign)
  • Vehicle_Turn_Status input is compared to Roadsign calibration constants, such as Vehicle_Turn_Status will be compared using compare to constant block
  • CameraInput_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 here we can compare both Vehicle_Turn_Status and CameraInput_RoadSign if both output are high Using Mux block we took only one among them is finally given as output signal (Signal Name: Vehicle_Direction_Indicator)
  • MUX took all 3 input signal and helps us to determine one final direction.

Construction_of_Vehicle_direction_detection_Model_Design :

Vehicle_direction_detection_Subsystem :

Requirements were linked to subsystem 1 and subsystem 2:

  • Requirement Tagging is also one of the Objective of the project. We can do the Requirement Tagging by simply selecting the heading of our requirement in the Word File and then Link the Selection in Word from Requirement section of subsystem.
  • After clicking on the Requirement tagged, the Requirement document opens up and the Subsystem is highlighted.

Screenshot-1 :

Sceenshot-2 :

Given Parameters 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

-

-

Simulink data dictionary from given Signal and calibration values:

SLDD Creation:

Solver settings done per the requirements : Sample time for all signals as 0.01s was chosen

Model Advisor :

Model advisor as a tool is available in in core Simulink blockset that automatically enables the user to check for common modelling mistakes which we missed out to notice during model development

The Model Advisor can analyze the model throughly or a sub set of model upon selecting model advisor option as below, developer can choose which version we would like to test.

Model Advisory Report :

C Code Generation : Code Generation process will be executed by following steps. We have already done the settings required in the Configuration Settings shown below. Now, we simply have to go to Apps section and click on Embedded Coder. Further, we click on Generate Code and we can a window pop-up with our Code. Simulink will create .c and .h files in our model folder, which means our code is successfully generated.

Code Generation Report:

Code generated:

File: Week_11_data.c

1	/*
2	 * Week_11_data.c
3	 *
4	 * Code generation for model "Week_11".
5	 *
6	 * Model version              : 1.8
7	 * Simulink Coder version : 9.1 (R2019a) 23-Nov-2018
8	 * C source code generated on : Thu Sep 29 19:39:45 2022
9	 *
10	 * Target selection: grt.tlc
11	 * Note: GRT includes extra infrastructure and instrumentation for prototyping
12	 * Embedded hardware selection: Intel->x86-64 (Windows64)
13	 * Code generation objectives: Unspecified
14	 * Validation result: Not run
15	 */
16	
17	#include "Week_11.h"
18	#include "Week_11_private.h"
19	
20	/* Block parameters (default storage) */
21	P_Week_11_T Week_11_P = {
22	  /* Variable: LeftTurn_RoadSign
23	   * Referenced by: '<S5>/Constant'
24	   */
25	  -120,
26	
27	  /* Variable: Left_Turn_AngularLimit
28	   * Referenced by: '<S3>/left_Turn_AngulatLimit'
29	   */
30	  -120,
31	
32	  /* Variable: RightTurn_RoadSign
33	   * Referenced by: '<S4>/Constant'
34	   */
35	  30,
36	
37	  /* Variable: Right_Turn_AngularLimit
38	   * Referenced by: '<S3>/Right_Turn_AngulatLimit'
39	   */
40	  30,
41	
42	  /* Variable: Straight_Drive_Steering_Angle
43	   * Referenced by: '<S3>/Straight_Drive_Steering_Angle'
44	   */
45	  0,
46	
47	  /* Variable: Straight_RoadSign
48	   * Referenced by: '<S6>/Constant'
49	   */
50	  0
51	};
52	

Conclusion:

Successfully created the model from the given requirement data and generated the code and advisor report.

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.