Challenge

Project 2 - Development of TFT Cluster Speedometer Software Component

Aim: To Develop the Simulink model based for TFT Cluster Speedometer Software Component and also create SLDD file and link the same to the model. Also perform the complete V and V workflow for the obtained model.

1.SIMULINK MODEL

1.1 Calculating TFT Display Speed

Average Vehicle Speed would be displayed only if its between 2 kmph & 250 kmph. Any value outside this range will be discarded by its lower limit & upper limit

When Average Vehicle Speed is < 2 kmph, DisplaySpeed = 2 kmph

When Average Vehicle Speed is in between 2 kmph & 250 kmph, DisplaySpeed = Average Vehicle Speed

When Average Vehicle Speed is > 250 kmph, DisplaySpeed = 250 kmph

1.2 Main Data Filtering

Main Data Filtering subsystem will be activated for every 10th millisecond

DisplaySpeed1 (t) = ((DisplaySpeed (t) x 0.65)/ Main Filter Speed Value) 0.05

1.3 Auxiliary Data Filtering

Auxiliary Data Filtering subsystem will be activated for every 10th millisecond

DisplaySpeed_Filter (t) = ((DisplaySpeed1 (t) x 0.78)/ Auxillary Filter Speed Value) - 0.03

1.4 TFT Speed Output

If |(DisplaySpeedFilter - DisplaySpeed)| > 1.5

{

Vehicle Speed Display = DisplaySpeed

}

else

{

Vehicle Speed Display = DisplaySpeed Filter

}

2.SLDD CREATION AND LINKING

3.REQUIREMENT TAGGING AND REPORT GENERATION

4.MODEL ADVISOR-JMAAB CHECK

5.FIXED TOOLBOX

6.SLDV ERROR DETECTION REPORT:

7.FUNCTIONAL TEST CASES, MIL,SIL, COVERAGE REPORT

MIL

SIL

C CODE:

/*
 * Event Support License -- for demonstration use and event support.  Not
 * for government, research, commercial, or other organizational use.
 *
 * File: TFT_Cluster_Speedometer.c
 *
 * Code generated for Simulink model 'TFT_Cluster_Speedometer'.
 *
 * Model version                  : 1.22
 * Simulink Coder version         : 9.7 (R2022a) 13-Nov-2021
 * C/C++ source code generated on : Thu Feb 16 17:24:55 2023
 *
 * Target selection: ert.tlc
 * Embedded hardware selection: Intel->x86-64 (Windows64)
 * Code generation objectives: Unspecified
 * Validation result: Not run
 */

#include "TFT_Cluster_Speedometer.h"
#include "rtwtypes.h"
#include "TFT_Cluster_Speedometer_private.h"
#include <math.h>
#include "rt_nonfinite.h"
#include <float.h>

/* Exported data definition */

/* Definition for custom storage class: ExportToFile */
real_T Vehicle_Speed_Display;          /* '<S6>/Switch' */

/* Block signals (default storage) */
B_TFT_Cluster_Speedometer_T TFT_Cluster_Speedometer_B;

/* Real-time model */
static RT_MODEL_TFT_Cluster_Speedome_T TFT_Cluster_Speedometer_M_;
RT_MODEL_TFT_Cluster_Speedome_T *const TFT_Cluster_Speedometer_M =
  &TFT_Cluster_Speedometer_M_;
real_T rt_remd_snf(real_T u0, real_T u1)
{
  real_T y;
  if (rtIsNaN(u0) || rtIsNaN(u1) || rtIsInf(u0)) {
    y = (rtNaN);
  } else if (rtIsInf(u1)) {
    y = u0;
  } else if ((u1 != 0.0) && (u1 != trunc(u1))) {
    real_T q;
    q = fabs(u0 / u1);
    if (!(fabs(q - floor(q + 0.5)) > DBL_EPSILON * q)) {
      y = 0.0 * u0;
    } else {
      y = fmod(u0, u1);
    }
  } else {
    y = fmod(u0, u1);
  }

  return y;
}

/* Model step function */
void TFT_Cluster_Speedometer_step(void)
{
  /* Saturate: '<S5>/Saturation' incorporates:
   *  Inport: '<Root>/Average_Vehicle_Speed'
   */
  if (Average_Vehicle_Speed > 250.0) {
    /* Saturate: '<S5>/Saturation' */
    Vehicle_Speed_Display = 250.0;
  } else if (Average_Vehicle_Speed < 2.0) {
    /* Saturate: '<S5>/Saturation' */
    Vehicle_Speed_Display = 2.0;
  } else {
    /* Saturate: '<S5>/Saturation' */
    Vehicle_Speed_Display = Average_Vehicle_Speed;
  }

  /* End of Saturate: '<S5>/Saturation' */

  /* Outputs for Enabled SubSystem: '<S1>/Auxiliary_Data_Filtering' incorporates:
   *  EnablePort: '<S3>/Enable'
   */
  /* Outputs for Enabled SubSystem: '<S1>/ Main_Data_Filtering' incorporates:
   *  EnablePort: '<S2>/Enable'
   */
  /* RelationalOperator: '<S7>/Compare' incorporates:
   *  Constant: '<S4>/Constant'
   *  Constant: '<S7>/Constant'
   *  Inport: '<Root>/Timer_Speed'
   *  Math: '<S4>/Rem'
   */
  if (rt_remd_snf(Timer_Speed, 10.0) == 10.0) {
    /* Sum: '<S3>/Sum' incorporates:
     *  Constant: '<S2>/Constant'
     *  Constant: '<S3>/Constant'
     *  Gain: '<S2>/Gain'
     *  Gain: '<S3>/Gain'
     *  Inport: '<Root>/Auxillary_Filter_Speed'
     *  Inport: '<Root>/Main_Filter_Speed'
     *  Product: '<S2>/Divide'
     *  Product: '<S3>/Divide'
     *  Sum: '<S2>/Sum'
     */
    TFT_Cluster_Speedometer_B.Display_Speed_Filter = (0.65 *
      Vehicle_Speed_Display / Main_Filter_Speed - 0.05) * 0.78 /
      Auxillary_Filter_Speed - 0.03;
  }

  /* End of RelationalOperator: '<S7>/Compare' */
  /* End of Outputs for SubSystem: '<S1>/ Main_Data_Filtering' */
  /* End of Outputs for SubSystem: '<S1>/Auxiliary_Data_Filtering' */

  /* Switch: '<S6>/Switch' incorporates:
   *  Abs: '<S6>/Abs'
   *  Constant: '<S6>/Constant'
   *  RelationalOperator: '<S6>/GreaterThan'
   *  Sum: '<S6>/Sum'
   */
  if (!(fabs(TFT_Cluster_Speedometer_B.Display_Speed_Filter -
             Vehicle_Speed_Display) > 1.5)) {
    /* Saturate: '<S5>/Saturation' incorporates:
     *  Switch: '<S6>/Switch'
     */
    Vehicle_Speed_Display = TFT_Cluster_Speedometer_B.Display_Speed_Filter;
  }

  /* End of Switch: '<S6>/Switch' */
}

/* Model initialize function */
void TFT_Cluster_Speedometer_initialize(void)
{
  /* Registration code */

  /* initialize non-finites */
  rt_InitInfAndNaN(sizeof(real_T));
}

/* Model terminate function */
void TFT_Cluster_Speedometer_terminate(void)
{
  /* (no terminate code required) */
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */

8.Poly space analysis report / outputs

Steps to create a Polyspace Report:

  • Initially, open the Polyspace in that new project click on start new project.
  • The Project Properties dialogue box will open in that give the project name as we saved in the MATLAB,then select the location where it we need to save after that click Next or use the default location.
  • Then ,it asks for the Projrct source,click on browserand select the folder where th .c file are generated then optionally we can add the include folder then clock on finish,the polyspace environment will open.
  • In the configuraton settings option called Target & compiler select the source code language as c,change the target processor as X86_64.
  • In the coding standards & code Metrics in that enable the check MISRA C:2004 also select the calculate the code metrics option
  • After that go to bug finder analysis under that select the default one.
  • Go to reporting enable the generate report option and ouput formet as PDF or any file we need
  • Finally save the polyspace and run the Bug Finder

9.Test Manager report- baseline and back to back testing

BACK TO BACK TESTING:

10.Results: Thus complete V and V workflow done for TFT Cluster Speedometer

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.