Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Aim:

To generate a Model for Vehicle direction determination.

Model:

Sub-system 1:

The warning says the unit Deg is undefined

Sub system 2:

The requirement tagging was done for both the subsystems:

The SLDD was prepared:

The generated code is as follows:

/*
 * File: Week11_directionDetection.c
 *
 * Code generated for Simulink model 'Week11_directionDetection'.
 *
 * Model version                  : 1.3
 * Simulink Coder version         : 9.3 (R2020a) 18-Nov-2019
 * C/C++ source code generated on : Sun May  1 16:10:06 2022
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "Week11_directionDetection.h"
#include "Week11_directionDetection_private.h"

/* Exported data definition */

/* Definition for custom storage class: ExportToFile */
boolean_T Vehicle_Direction_Indicator; /* '<S2>/OR' */

/* Const memory section */
/* Definition for custom storage class: Const */
const int16_T LeftTurn_RoadSign = -120;/* Referenced by: '<S2>/Constant1' */
const int16_T Left_Turn_AngularLimit = -120;/* Referenced by: '<S3>/Constant3' */
const int16_T RightTurn_RoadSign = 30; /* Referenced by: '<S2>/Constant' */
const int16_T Right_Turn_AngularLimit = 30;/* Referenced by: '<S3>/Constant' */
const int16_T Straight_Drive_Steering_Angle = 0;/* Referenced by: '<S3>/Constant2' */
const int16_T Straight_RoadSign = 0;   /* Referenced by: '<S2>/Constant2' */

/* Real-time model */
RT_MODEL_Week11_directionDete_T Week11_directionDetection_M_;
RT_MODEL_Week11_directionDete_T *const Week11_directionDetection_M =
  &Week11_directionDetection_M_;

/* Model step function */
void Week11_directionDetection_step(void)
{
  /* local block i/o variables */
  int16_T Vehicle_Turn_Status;

  /* Switch: '<S3>/Switch' incorporates:
   *  Constant: '<S3>/Constant'
   *  Constant: '<S3>/Constant3'
   *  Inport: '<Root>/Input'
   *  Switch: '<S3>/Switch1'
   */
  if (SteeringWheel_YawDegreeInput > 0) {
    Vehicle_Turn_Status = Right_Turn_AngularLimit;
  } else if (SteeringWheel_YawDegreeInput >= 0) {
    /* Switch: '<S3>/Switch1' incorporates:
     *  Constant: '<S3>/Constant2'
     */
    Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
  } else {
    Vehicle_Turn_Status = Left_Turn_AngularLimit;
  }

  /* End of Switch: '<S3>/Switch' */

  /* Logic: '<S2>/OR' incorporates:
   *  Constant: '<S2>/Constant'
   *  Constant: '<S2>/Constant1'
   *  Constant: '<S2>/Constant2'
   *  Inport: '<Root>/Input1'
   *  Logic: '<S2>/AND'
   *  Logic: '<S2>/AND1'
   *  Logic: '<S2>/AND2'
   *  RelationalOperator: '<S2>/Equal'
   *  RelationalOperator: '<S2>/Equal1'
   *  RelationalOperator: '<S2>/Equal2'
   */
  Vehicle_Direction_Indicator = ((CameraInput_RoadSign && (RightTurn_RoadSign ==
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.

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.