Challenge

Project 1 - Wiper control system and Vehicle speed calculation for ABS using Wheel Speed sensor

Aim:To Develop the Simulink model for wiper control system based on the given conditions and also create SLDD file and link the same to the model. Perform the complete V and V workflow for the obtained models.

Conditions:

  1. If the density of the rain is low, then wiper rotates with low speed & the output signal should be 100rpm
  2. If the density of the rain is medium, then wiper rotates with medium speed & the output signal should be 200rpm
  3. If the density of the rain is high, then wiper rotates with high speed & the output signal should be 500rpm

1.Simulink model:

Aim:

To develop a Simulink/state flow modules for wiper control system based on the given conditions.

Conditions:

  1. If the density of the rain is low, then wiper rotates with low speed, the output signal should be 100rpm
  2. If the density of the rain is medium, then wiper rotates with low speed, the output signal should be 200rpm
  3. If the density of the rain is high, then wiper rotates with low speed, the output signal should be 500rpm

1.Simulink model file:

2.SLDD CREATION:

3.Requirement tagging report:

Goto apps and click requirement editor

4.Model Advisor- JMAAB Report

5.Fixed point toolbox

6.SLDV ERROR DETECTION REPORT:

7.Functional test cases, MIL,SIL, COVERAGE REPORT

MIL TEST HARNESS

SIL

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

#include "Subsystem.h"
#include "rtwtypes.h"

/* Named constants for Chart: '<S1>/Chart' */
#define Subsystem_IN_High              ((uint8_T)1U)
#define Subsystem_IN_Low               ((uint8_T)2U)
#define Subsystem_IN_Medium            ((uint8_T)3U)
#define Subsystem_IN_Range             ((uint8_T)4U)

/* Block states (default storage) */
DW_Subsystem_T Subsystem_DW;

/* External inputs (root inport signals with default storage) */
ExtU_Subsystem_T Subsystem_U;

/* External outputs (root outports fed by signals with default storage) */
ExtY_Subsystem_T Subsystem_Y;

/* Real-time model */
static RT_MODEL_Subsystem_T Subsystem_M_;
RT_MODEL_Subsystem_T *const Subsystem_M = &Subsystem_M_;

/* Model step function */
void Subsystem_step(void)
{
  /* Outputs for Atomic SubSystem: '<Root>/Subsystem' */
  /* Chart: '<S1>/Chart' incorporates:
   *  Inport: '<Root>/Density'
   */
  if (Subsystem_DW.is_active_c1_Subsystem == 0U) {
    Subsystem_DW.is_active_c1_Subsystem = 1U;
    Subsystem_DW.is_c1_Subsystem = Subsystem_IN_Range;

    /* Outport: '<Root>/wiper_speed' */
    Subsystem_Y.wiper_speed = 0.0;
  } else {
    switch (Subsystem_DW.is_c1_Subsystem) {
     case Subsystem_IN_High:
      /* Outport: '<Root>/wiper_speed' */
      Subsystem_Y.wiper_speed = 500.0;
      break;

     case Subsystem_IN_Low:
      /* Outport: '<Root>/wiper_speed' */
      Subsystem_Y.wiper_speed = 100.0;
      break;

     case Subsystem_IN_Medium:
      /* Outport: '<Root>/wiper_speed' */
      Subsystem_Y.wiper_speed = 200.0;
      break;

     default:
      /* Outport: '<Root>/wiper_speed' */
      /* case IN_Range: */
      Subsystem_Y.wiper_speed = 0.0;
      if (Subsystem_U.Density <= 30.0) {
        Subsystem_DW.is_c1_Subsystem = Subsystem_IN_Low;

        /* Outport: '<Root>/wiper_speed' */
        Subsystem_Y.wiper_speed = 100.0;
      } else if (Subsystem_U.Density > 60.0) {
        Subsystem_DW.is_c1_Subsystem = Subsystem_IN_High;

        /* Outport: '<Root>/wiper_speed' */
        Subsystem_Y.wiper_speed = 500.0;
      } else if ((Subsystem_U.Density > 30.0) && (Subsystem_U.Density < 60.0)) {
        Subsystem_DW.is_c1_Subsystem = Subsystem_IN_Medium;

        /* Outport: '<Root>/wiper_speed' */
        Subsystem_Y.wiper_speed = 200.0;
      }
      break;
    }
  }

  /* End of Chart: '<S1>/Chart' */
  /* End of Outputs for SubSystem: '<Root>/Subsystem' */
}

/* Model initialize function */
void Subsystem_initialize(void)
{
  /* (no initialization code required) */
}

/* Model terminate function */
void Subsystem_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

Aim:To Develop the Simulink model the vehicle speed calculation unit inside the ABS system based on the given conditions and also create SLDD file and link the same to the model. Perform the complete V and V workflow for the obtained models.

1.Simulink model:

2.SLDD CREATION

3.Requirement tagging report:

4.Model Advisor- JMAAB Report

5.Fixed point toolbox

6.SLDV ERROR DETECTION REPORT:

7.Functional test cases, MIL,SIL, COVERAGE REPORT

MIL TEST HARNESS

SIL

/*


 * Event Support License -- for demonstration use and event support.  Not


 * for government, research, commercial, or other organizational use.


 *


 * File: project1b.c


 *


 * Code generated for Simulink model 'project1b'.


 *


 * Model version                  : 1.31


 * Simulink Coder version         : 9.7 (R2022a) 13-Nov-2021


 * C/C++ source code generated on : Mon Feb  6 13:11:10 2023


 *


 * Target selection: ert.tlc


 * Embedded hardware selection: Intel->x86-64 (Windows64)


 * Code generation objectives: Unspecified


 * Validation result: Not run


 */





#include "project1b.h"


#include "rtwtypes.h"


#include "multiword_types.h"


#include "project1b_private.h"


#include <math.h>





/* Named constants for Chart: '<S1>/Chart' */


#define project1b_IN_Start             ((uint8_T)1U)


#define project1b_IN_vehiclespeed1     ((uint8_T)2U)


#define project1b_IN_vehiclespeed10    ((uint8_T)3U)


#define project1b_IN_vehiclespeed12    ((uint8_T)4U)


#define project1b_IN_vehiclespeed13    ((uint8_T)5U)


#define project1b_IN_vehiclespeed14    ((uint8_T)6U)


#define project1b_IN_vehiclespeed15    ((uint8_T)7U)


#define project1b_IN_vehiclespeed16    ((uint8_T)8U)


#define project1b_IN_vehiclespeed2     ((uint8_T)9U)


#define project1b_IN_vehiclespeed3     ((uint8_T)10U)


#define project1b_IN_vehiclespeed4     ((uint8_T)11U)


#define project1b_IN_vehiclespeed6     ((uint8_T)12U)


#define project1b_IN_vehiclespeed7     ((uint8_T)13U)


#define project1b_IN_vehiclespeed9     ((uint8_T)14U)





/* Block states (default storage) */


DW_project1b_T project1b_DW;





/* External outputs (root outports fed by signals with default storage) */


ExtY_project1b_T project1b_Y;





/* Real-time model */


static RT_MODEL_project1b_T project1b_M_;


RT_MODEL_project1b_T *const project1b_M = &project1b_M_;


real_T uMultiWord2Double(const uint32_T u1[], int32_T n1, int32_T e1)


{


  real_T y;


  int32_T exp_0;


  int32_T i;


  y = 0.0;


  exp_0 = e1;


  for (i = 0; i < n1; i++) {


    y += ldexp(u1[i], exp_0);


    exp_0 += 32;


  }





  return y;


}





/* Model step function */


void project1b_step(void)


{


  /* Outputs for Atomic SubSystem: '<Root>/Subsystem' */


  /* Chart: '<S1>/Chart' incorporates:


   *  DataTypeConversion: '<Root>/Subsystem_boundary_DTC'


   *  DataTypeConversion: '<Root>/Subsystem_boundary_DTC1'


   *  DataTypeConversion: '<Root>/Subsystem_boundary_DTC2'


   *  DataTypeConversion: '<Root>/Subsystem_boundary_DTC3'


   */


  if (project1b_DW.is_active_c3_project1b == 0U) {


    project1b_DW.is_active_c3_project1b = 1U;


    project1b_DW.is_c3_project1b = project1b_IN_Start;


  } else {


    switch (project1b_DW.is_c3_project1b) {


     case project1b_IN_Start:


      {


        real_T tmp;


        real_T tmp_0;


        real_T tmp_1;


        real_T tmp_2;





        /* DataTypeConversion: '<Root>/Subsystem_boundary_DTC' incorporates:


         *  Inport: '<Root>/fl'


         */


        tmp = uMultiWord2Double(&fl.chunks[0U], 2, 0);





        /* DataTypeConversion: '<Root>/Subsystem_boundary_DTC1' incorporates:


         *  Inport: '<Root>/fr'


         */


        tmp_0 = uMultiWord2Double(&fr.chunks[0U], 2, 0);





        /* DataTypeConversion: '<Root>/Subsystem_boundary_DTC2' incorporates:


         *  Inport: '<Root>/rl'


         */


        tmp_1 = uMultiWord2Double(&rl.chunks[0U], 2, 0);





        /* DataTypeConversion: '<Root>/Subsystem_boundary_DTC3' incorporates:


         *  Inport: '<Root>/rr'


         */


        tmp_2 = uMultiWord2Double(&rr.chunks[0U], 2, 0);


        if ((tmp > 0.0) && (tmp_0 == 0.0) && (tmp_1 == 0.0) && (tmp_2 > 0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed16;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = (tmp + tmp_2) / 2.0;


        } else if ((tmp > 0.0) && (tmp_0 > 0.0) && (tmp_1 > 0.0) && (tmp_2 > 0.0))


        {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed1;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = (((tmp + tmp_0) + tmp_1) + tmp_2) / 4.0;


        } else if ((tmp_0 > 0.0) && (tmp_1 > 0.0) && (tmp_2 > 0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed12;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = ((tmp_0 + tmp_1) + tmp_2) / 3.0;


        } else if ((tmp > 0.0) && (tmp_1 > 0.0) && (tmp_2 > 0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed2;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = ((tmp + tmp_1) + tmp_2) / 3.0;


        } else if ((tmp > 0.0) && (tmp_0 > 0.0) && (tmp_1 == 0.0) && (tmp_2 >


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed13;





          /* Outport: '<Root>/Vehicle_speed' incorporates:


           *  Inport: '<Root>/fl'


           *  Inport: '<Root>/fr'


           */


          project1b_Y.Vehicle_speed = ((uMultiWord2Double(&fl.chunks[0U], 2, 0)


            + uMultiWord2Double(&fr.chunks[0U], 2, 0)) + tmp_2) / 3.0;


        } else if ((tmp > 0.0) && (tmp_0 > 0.0) && (tmp_1 > 0.0) && (tmp_2 ==


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed4;





          /* Outport: '<Root>/Vehicle_speed' incorporates:


           *  Inport: '<Root>/fl'


           *  Inport: '<Root>/fr'


           *  Inport: '<Root>/rl'


           */


          project1b_Y.Vehicle_speed = ((uMultiWord2Double(&fl.chunks[0U], 2, 0)


            + uMultiWord2Double(&fr.chunks[0U], 2, 0)) + uMultiWord2Double


            (&rl.chunks[0U], 2, 0)) / 3.0;


        } else if ((tmp == 0.0) && (tmp_0 == 0.0) && (tmp_1 > 0.0) && (tmp_2 >


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed14;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = (tmp_1 + tmp_2) / 2.0;


        } else if ((tmp > 0.0) && (tmp_0 > 0.0) && (tmp_1 == 0.0) && (tmp_2 ==


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed15;





          /* Outport: '<Root>/Vehicle_speed' incorporates:


           *  Inport: '<Root>/fl'


           *  Inport: '<Root>/fr'


           */


          project1b_Y.Vehicle_speed = (uMultiWord2Double(&fl.chunks[0U], 2, 0) +


            uMultiWord2Double(&fr.chunks[0U], 2, 0)) / 2.0;


        } else if ((tmp == 0.0) && (tmp_0 > 0.0) && (tmp_1 > 0.0) && (tmp_2 ==


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed7;





          /* Outport: '<Root>/Vehicle_speed' incorporates:


           *  Inport: '<Root>/fr'


           *  Inport: '<Root>/rl'


           */


          project1b_Y.Vehicle_speed = (uMultiWord2Double(&fr.chunks[0U], 2, 0) +


            uMultiWord2Double(&rl.chunks[0U], 2, 0)) / 2.0;


        } else if ((tmp == 0.0) && (tmp_0 > 0.0) && (tmp_1 == 0.0) && (tmp_2 >


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed10;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = (tmp_0 + tmp_2) / 2.0;


        } else if ((tmp > 0.0) && (tmp_0 == 0.0) && (tmp_1 > 0.0) && (tmp_2 ==


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed6;





          /* Outport: '<Root>/Vehicle_speed' incorporates:


           *  Inport: '<Root>/fl'


           *  Inport: '<Root>/rl'


           */


          project1b_Y.Vehicle_speed = (uMultiWord2Double(&fl.chunks[0U], 2, 0) +


            uMultiWord2Double(&rl.chunks[0U], 2, 0)) / 2.0;


        } else if (((tmp > 0.0) && (tmp_0 == 0.0) && (tmp_1 == 0.0) && (tmp_2 ==


          0.0)) || ((tmp == 0.0) && (tmp_0 > 0.0) && (tmp_1 == 0.0) && (tmp_2 ==


          0.0)) || ((tmp == 0.0) && (tmp_0 == 0.0) && (tmp_1 > 0.0) && (tmp_2 ==


          0.0)) || ((tmp == 0.0) && (tmp_0 == 0.0) && (tmp_1 == 0.0) && (tmp_2 >


          0.0))) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed9;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = 0.0;


        } else if ((tmp == 0.0) && (tmp_0 == 0.0) && (tmp_1 == 0.0) && (tmp_2 ==


                    0.0)) {


          project1b_DW.is_c3_project1b = project1b_IN_vehiclespeed3;





          /* Outport: '<Root>/Vehicle_speed' */


          project1b_Y.Vehicle_speed = 0.0;


        }


      }


      break;





     case project1b_IN_vehiclespeed1:


     case project1b_IN_vehiclespeed10:


     case project1b_IN_vehiclespeed12:


     case project1b_IN_vehiclespeed13:


     case project1b_IN_vehiclespeed14:


     case project1b_IN_vehiclespeed15:


     case project1b_IN_vehiclespeed16:


     case project1b_IN_vehiclespeed2:


     case project1b_IN_vehiclespeed3:


     case project1b_IN_vehiclespeed4:


     case project1b_IN_vehiclespeed6:


     case project1b_IN_vehiclespeed7:


      break;





     default:


      /* case IN_vehiclespeed9: */


      break;


    }


  }





  /* End of Chart: '<S1>/Chart' */


  /* End of Outputs for SubSystem: '<Root>/Subsystem' */


}





/* Model initialize function */


void project1b_initialize(void)


{


  /* (no initialization code required) */


}





/* Model terminate function */


void project1b_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

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.