Project 1 (Mini Project on Vehicle Direction Detection
Aim: To develop the Vehicle Direction Determination model using simulink.
Objective of Mini Project:
- To Development of MATLAB Simulink model as per requirement.
- To Tag the requirements to the simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.
- To create 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.
- To choose sample time for all signals as 0.002 seconds
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 :
- To create the word document for given question for better understanding and do requirement tag and that word document will place one particular folder for this whole model use that folder
- Then open the matlab and then open simulink blank model. Then go to modeling tab and click on the link to data Dictionary in the design data

- Then create one new file of SLDD file for data and open the that file in model explorer and add signals and date in that file is shown in give below figure

- Then go to Library and add required block for builed the Vehicle Direction Determination model for given requirements
- After that made connections as the requirement for the block it will given below.
Vehicle Direction Determinatination model

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

- For Requirement-1 Model use blocks of Input, Output, constant, Campare to zero, Switch, Goto and From Blocks and made connections by giving in the requirements
- After made this block we made a Requirement tag for lead vehicle by right clicking on the block then clink on the requirement then click on the link to selection in word.
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).

- For Requirement-2 Model use blocks of Input, Output, constant, Logical operator, Relational operator, Goto and From Blocks and made connections by giving in the requirements
- After made this block we made a Requirement tag for lead vehicle by right clicking on the block then clink on the requirement then click on the link to selection in word

- After completion of all the connections the model has ready its shown like given below fig

After create the model then go to model settings and then click on the solver confirmation parameters the change the solver selection type to fixed and solver to discrete and then change the solver step size to 0.002sec 
- After that go to code generation and change the systen target file to ert.tle (embedded coder)

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

After we can determine the model advisor we can determine
MIL(model_in_loop) Test
SIL(software_in_loop)Test
Embedded C-code
(Model_in_loop) MIL Test :
First we go to test harness we create a subsystem.

After save the file we can also check whether it is connected or not

First,we create a excel file and name as module4_miniproject and stored in the same path

it can open and go to the file section and import to file when wever the excel is stored we must be choose that file in same path.

After we browse that excel file and some conditions are given,Excel file sheet is converted in to the signal builder of that values

Here we can import to the sginal builder and we can add to the outputsignal, so first we can add demux block and we can add 3 ADD blocks.. One ia taken as demux signal and the another signal signal is taken as the signal builder block..
Here we determine the difference of the both signals having test harness model and the sum block added to the scope. we can see the values by using the scope
And taking simulation time as 0.1

Result : Here we can decide what is the value difference between the signal builder signal and the test mode signal based on sldd. so we can see the scope here it passes through the zero line , that means it has exact output is coming when compared to the data.

SIL(software_in_loop)Test :
we can here also create the test harness model and create a subsytem and the input as a signal builder
we doing the test harness block one more condition is to be added in sil.If we go to basic properties input set as signal builder and we go to the advanced properties of the system verification mode is to be set as software in the loop.

After we can select the software_in_loop model it will come another test harness block and in design verifier block we can tselect treat as atomic unit

Finally the test harness shown like this

Then the harness SIL model will come like this
we have the signal builder and we can import the file by using the import from base workspace.Then the signal is to be taken

After wen can import the excel file then the signalbuilder has

Here also we can use the demux block because by taking 3 signals and we add 3 add blocks. we can determine what is the value difference between the signal builder signal and the test mode signal based on sldd. so we can see the scope here it passes through the zero line , that means it has exact output is coming when compared to the data.
Finally the test Harness model taken as

We can the ouput valu value to determine the difference of the test harness signals and the signal builder signals, as zero output it has no changes in both cases

After that SIL is to be determined that we can generate the embedded coder so we goto the Apps we can select the embedded coder

we got another block as C-code if we click on build then it automatically generate the C-code