Project 1 (Mini Project on Vehicle Direction Detection
Mini Project - Vehicle Direction Determination
Objective:
- Development 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.
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.

- The above simulation model is created according to the requirement.
- There are two inputs to the system as SteeringWheel_YawDegreeInput and Camera Input_RoadSign.

- The subsystem of the model is shown above.
- It contains the two subsystems of the Requirement 1 and the Requirement 2.

- First we have to create the sldd file.
- For that go into the modelling tab of the task bar.
- Under design category there is the Link to Data Dictionary option and then click on it.

- It will open a model parameter properties window.
- The by clicking on the new option, 'Detail_Data.sldd' file is created.
- Uncheck the 'Enable model access to base workspace' by doing this the data will not stored in the base workspace.

- Then open the model explorer from the same design category of modelling tab.
- In the model hierarchy of model workspace, the new tab of the external data is created.
- Then in the design option of the external data we have to add all the signals and parameters of the model.

- Then in the model explorer all the simulink signals and parameters are added.
- The minimum and maximum value, data type, dimensions, storage class, unit and the parameter values are given for the respective signal or parameter added.
- Storage class for input signal is given as ImportedExtern.
- The storage class for the local signal is given as localizable.
- The storage class for the output signals are given as ExportToFile.
- The storage class for the calibration parameters are Const.
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 above simulink model is created for the requirement 1.
- The value of the right turn angular limit is 30, if the input signal steering wheel is equal to the 30 then the true value means the value of the right turn angular limit goes to the output.
- If this condition does not matches then the input from the other switch goes to the output.
- Same procedure applies to the other switches.
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).

- The above simulink model is created for the requirement 2.
- In this system, the value of the right sign is 30, if the input vehicle turn status is 30 means if it is right turn angular limit then it goes to the AND block.
- AND block will cheack the road condition from the Camera road sign.
- If both the conditions are 1 then it will give the signal for direction of the vehicle.
- In this manner all the conditions are check and the direction is provided to the vehicle.

- In the configuration parameter, solver type is selected as Fixed-step.
- The solver is selected as discrete (no-continuous states).
- And the sample time is 0.01 sec as per the requirement.


- Then in the code generation, System target file is selected as ert.tlc.

- In the coverage section, Enable coverage analysis is selected by checking the box.
- The structural coverage level is selected as Modified Condition Decision Coverage (MCDC).
- This will check for the total execution of the system during the simution of the model.

- Then both the subsystems of the requirements are tagged with the respective requirements.
- For that first open the word file containing all the details of the model.
- Then select the word requirement in the word file.
- After that right click on the subsystem of the requirement block.
- Then in the requirement section click on the Link to Selection in word.

- After that Requirement-1 will appear in the requirement section as above.
- The same procedure is applied to the second requirement block.

- For signal resolving, click on the signal and right click on the signal.
- Then click on the properties and it will open a signal properties window.

- In the Signal name give the Name of the signal as given here 'SteeringWheel_YawDegreeinput'.
- Then click on the Signal name must resolve to Simulink signal object.
- Then apply the changes.

- For propagating the signal double click and type <> on the signal then enter.
- Then the signal name will come as shown below.

- The propagated signal will show in the <> element as shown above.

- In the modelling section click on the Model Advisor for generating the MAAB guidlines report.

- Select the model system for the report generation.

- After opening the new window, select the Modelling Standards for MAB in the by task section.

- After clicking on the Run Selected Checks, the summary of the report is generated showing the total pass cases, fail cases and the warnings.

- In the APPS tab select the Embedded Coder option for generating the code.
- It will open a new tab of the C CODE.

- Then in the C CODE, click on the build option.
- Then it will run for the code generation and shows the C code generated.

- If we click on the perticular block name in the C code then this block will appear on the screen with the blue colour this is called the traceability.
- The C Code generated in the model is shown below.



