Level of Automation

Vehicle Direction Detection can be done alongside the GPS system in order to optimize the range direction.
Objective
1. To develop the Matlab Simulink Model
2. Requirement to be tagged to the Simulink model with requirement tagger.
3. Changing the MBD Complaint along with code generation and data dictionary.
4. Samole time 0.01s
First Requirement
a. Steering wheel input is considered as yaw rate is taken input to the system.
b. The input is compared to the three angular output, namely left turn , right turn and round turn.
c. Calibaration values- left_turn angular limit, Right_turn angular limit, Round_turn limit.
d. Switch is used to compare and develop the requirement.
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).
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
|
-
|
Design of Matlab model
This is the main model subsytem which have two inputs. Steeringwheel_Yawdegreeinput and camera_inputroadsign which is taken as Vehicle Direction Detection subsystem.
The Vehicle direction detection Subsystem consist of two different subsystem namely Vehicle turn status subsystem and Vehicle direction Indicator subsystem.
Requirement 1
Vehicle turn status subsystem
Steering wheel input as yaw rate is taken as input to the system.
This input is compared with three angular values Left turn angular limit , Right turn Angular limit and Straight drive Angular limit.
Switch is used to compare and develop the requirement and output is local signal.
Requirement 2
Input taken here is a local signal from the requirement 1 ie the signal from the Vehicle turn status.
Signal from the Vehicle turn status is compared with calibration values of left turn , right turn and straight road sign.
If all of them found equal then output is compared with the camera input road sign.
2. Requirement Tagging
General subsystem
Deloping SLDD
3. Signal Resolution
5. Model Update
Model can be updated by clicking CTRLD
6. Simulation
Model is simulated for checking errors and warnings
7. Configuartion Parameters
8. Model Advisory Report
Model Advisory Report
Tracebility Report
9. Code Generation
Code generation can bedone by clicking Emmbeded code option from Toolbar


/*
* File: project_Vehicle_Direction_Detection.c
*
* Code generated for Simulink model 'project_Vehicle_Direction_Detection'.
*
* Model version : 1.2
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Tue Dec 7 11:59:39 2021
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "project_Vehicle_Direction_Detection.h"
#include "project_Vehicle_Direction_Detection_private.h"
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
boolean_T Vehicledirection_indicator; /* '/Logical Operator3' */
/* Real-time model */
static RT_MODEL_project_Vehicle_Dire_T project_Vehicle_Direction_De_M_;
RT_MODEL_project_Vehicle_Dire_T *const project_Vehicle_Direction_De_M =
&project_Vehicle_Direction_De_M_;
/* Model step function */
void project_Vehicle_Direction_Detection_step(void)
{
int16_T rtb_Switch;
/* Switch: '/Switch' incorporates:
* Constant: '/Leftturn_Angularlimit'
* Constant: '/Rightturn_Angularlimit'
* Inport: '/Steeringwheel_Yawdegreeinput'
* Switch: '/Switch1'
*/
if (Steeringwheel_Yawdegreeinput > 25) {
rtb_Switch = 30;
} else if (Steeringwheel_Yawdegreeinput > 0) {
/* Switch: '/Switch1' incorporates:
* Constant: '/Straightdrive_Steeringangle'
*/
rtb_Switch = 0;
} else {
rtb_Switch = 120;
}
/* End of Switch: '/Switch' */
/* Logic: '/Logical Operator3' incorporates:
* Constant: '/Leftturn_roadsign'
* Constant: '/Rightturn_roadsign'
* Inport: '/camerainput_roadsign'
* Logic: '/Logical Operator'
* Logic: '/Logical Operator2'
* RelationalOperator: '/Equal'
* RelationalOperator: '/Equal2'
*/
Vehicledirection_indicator = ((camerainput_roadsign && (rtb_Switch == 30)) ||
(camerainput_roadsign && (rtb_Switch == 0)));
}
/* Model initialize function */
void project_Vehicle_Direction_Detection_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void project_Vehicle_Direction_Detection_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
Conclusion
1.The Vehicle Direction Detection has been Modelled acccording to the requiremnet.
2.All the signal has been modelled in simulink data dictionary.
3.All input and output signal are resolved and propogated.
4.Model is updated and checked for static errors.
5.Model advisor report has also been generated.
6.Lastly code generation has also been performed.