Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Aim:

To Create and Simulate the Vehicle Direction Detection based on the requirements using Matlab & Simulink.

Objective:

  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.
  3. Create SLDD file in simulink based on the input and output signals.
  4. Simulate the model and note down the results by varying logical operator.
  5. Test the model using MIL and SIL testing.

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.

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

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

Steps followed are:

To make a SLDD file.

1.Open a simulink model.

2.Click Modelling and press down arrow in the design.

3.Click link to data dictionary

4.Model properties box appears.

5. Click new and add new sldd file as mini project

6.Apply and close the box

7.Click model explorer and press external data and then press design data.

8.In design data add 6 parameters and 4 signals and edit as per the requirement

After adding all the parameters and signals,

9.After adding right click in the design data and save.

Simulink model creation:

Simulink model:

Here in the above model we first create a subsystem block and named as Vehicle_direction, 2 input and 1 output port block is made. 1st input is SteeringWheel_YawdegreeInput and 2nd input as CameraInput_RoadSign, and output as Vehicle_Direction_Indicator. And the signal passing lines are labelled.

Subsystem (Vehicle_direction):

Here in the above model input is received to the subsystem and passed to the next subsystem(Requirement_1) and another input to the subsystem(Requirement_2). And output port is named as Vehicle_direction_Indicator.

Subsytem(Requirement_1):

Here in the above model we use input as SteeringWheel_YawDegreeInput and uses different blocks as 2 constant block, 2 compare to zero, and 2 switch blocks and output is Vehicle_Turn_Status.

Subsystem(Requirement_2):

Here in the above model we use 3 Constant block, 3 Relational operator, 3 Logical operator, 3 From block, Goto block, Mux, signal conversion block and here inputs are Vehicle_turn_Status and CameraInput_RoadSign, and output port is Vehicle_direction_Indicator.

Requirement tagging:

A MS Word file is created which contain all the requirements and necessary information to develop the model appropiately. This Word file is tagged for both the subsystem Requirement1 and Requirement2 respectively.

10.Right click in the requirement 1 of the simulink model

11.Click Link to selection in word.

Similarly requirement 2 is tagged with word and then it shows as,

Requirement 1

Requirement 2

Configuration parameter:

12.Click model properties

13.Confihuration parameter box appears and select the values as below,

Select type as Fixed-step, solver as discrete (no continuous states)

14.Then click code generation and browse embedded codder (ert.file)

Model advisor report generation:

15.Run the model

16.then in the top left corner select model advisor

17.A system selector box appers, select and click apply.

18.Then click By task and select Modelling standards for MAB,

19.Click run selected checks.

Here only warnings is 5 and no fails condition.

20.Now click Generate report.

Model-In-Loop Testing(MIL) and Software-In-Loop Testing(SIL):

Model in loop:

21.Right click and select test harness

22.In test harness select create for subsystem..

23.Now 'create test harness' box appears and select the values as given below,

24.Press ok and the model will be initialzed and a model appears as below,

Now we want to input the values from xlsx file in the signal builder

25.Open signal builder

26.click file and select import from file

27.Browse the file and open xlsx file

Now we can add scope to each of the output.

And we can compare the signal from the signal builder and output, so that we can check the difference from the graph.

Then the model looks like,

28.Now run the simulink model for 4 sec

Result:

Scope 1 result:

Here from the scope it is clear that the result is as per the input signal.

Scope:

Here from the scope it is clear that, for all the 3 graph there is no difference between eachother.

Software in loop:

29.Right click and select test harness

30.In test harness select create for subsystem..

31.Now 'create test harness' box appears and select the values as given below,

32.Now select same as MIL and select verification mode as SIL.

33.Press ok and the model will be initialzed and a model appears as below,

Now we want to input the values from xlsx file in the signal builder

34.Open signal builder

35.click file and select import from file

36.Browse the file and open xlsx file.

Now we can add scope to each of the output.

And we can compare the signal from the signal builder and output, so that we can check the difference from the graph.

Then the model looks like,

37.Now run the simulink model for 4 sec

Result:

Scope 1 result:

Here from the scope it is clear that the result is as per the input signal.

Scope:

Here from the scope it is clear that, for all the 3 graph there is no difference between eachother.

Code generation:

38.Click App on the top

39.Click Build

And the code is generated as 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.