Challenge

Project 2 - Development of TFT Cluster Speedometer Software Component

Project 2

Solution

Here is a detailed step-by-step guide for developing the TFT Cluster Speedometer Software Component in Simulink, creating the SLDD file, and performing the V&V workflow as per the requirements.


Step 1: Create the Simulink Model

  1. Open Simulink:
    • Launch MATLAB.
    • Open Simulink by typing simulink in the MATLAB Command Window.
  2. Create a New Model:
    • In Simulink, click File > New > Model.
    • Save the model as TFT_Cluster_Speedometer.slx.


Step 2: Create and Link SLDD File

  1. Create SLDD File:
    • Open the Model Explorer (View > Model Explorer).
    • Right-click and select New > Simulink Data Dictionary.
    • Save the file as TFT_Cluster_Speedometer.sldd.
  2. Define Parameters in SLDD:
    • Open the SLDD file and add the following parameters:
      • Main_Filter_Speed_Value = 1.0 (default value)
      • Auxiliary_Filter_Speed_Value = 1.0 (default value)
  3. Link SLDD to the Model:
    • Open File > Model Properties.
    • In the External Data tab, link the SLDD file to the model.


Step 3: Implement the Model


Subsystem 1: Calculating TFT Display Speed

  1. Add Input:
    • Drag an Inport block from the Simulink Library Browser.
    • Rename it as Average_Vehicle_Speed.
  2. Add Logic for Speed Limiting:
    • Drag three Constant blocks:
      • Lower limit (2).
      • Upper limit (250).
    • Add two Compare To Constant blocks:
      • Compare if Average_Vehicle_Speed < 2.
      • Compare if Average_Vehicle_Speed > 250.
    • Add two Switch blocks:
      • First switch outputs 2 if the speed is below the lower limit, else it passes Average_Vehicle_Speed.
      • Second switch outputs 250 if the speed exceeds the upper limit, else it passes the output of the first switch.
  3. Add Output:
    • Add an Outport block and name it DisplaySpeed.
  4. Connect Blocks:
    • Connect the blocks as per the logic:
      • Average_Vehicle_Speed → First Compare Block → First Switch → Second Compare Block → Second Switch → DisplaySpeed.


Subsystem 2: Main Data Filtering

  1. Create a Subsystem:
    • Drag a Subsystem block.
    • Rename it to Main Data Filtering.
  2. Add Trigger for 10 ms Activation:
    • Double-click the subsystem.
    • Replace the default content with a Triggered Subsystem.
    • Set the trigger type to Time-Based with a sample time of 0.01.
  3. Implement Filtering Logic:
    • Inside the triggered subsystem:
      • Multiply DisplaySpeed by 0.65 using a Gain block.
      • Divide the result by Main_Filter_Speed_Value using a Divide block.
      • Multiply the output by 0.05 using another Gain block.
  4. Add Output:
    • Add an Outport block and name it DisplaySpeed1.
  5. Connect Blocks:
    • Connect the blocks as per the filtering logic.


Subsystem 3: Auxiliary Data Filtering

  1. Create a Subsystem:
    • Drag another Subsystem block.
    • Rename it to Auxiliary Data Filtering.
  2. Add Trigger for 10 ms Activation:
    • Double-click the subsystem.
    • Replace the default content with a Triggered Subsystem.
    • Set the trigger type to Time-Based with a sample time of 0.01.
  3. Implement Auxiliary Filtering Logic:
    • Inside the triggered subsystem:
      • Multiply DisplaySpeed1 by 0.78 using a Gain block.
      • Divide the result by Auxiliary_Filter_Speed_Value using a Divide block.
      • Subtract 0.03 using a Subtract block.
  4. Add Output:
    • Add an Outport block and name it DisplaySpeed_Filter.
  5. Connect Blocks:
    • Connect the blocks as per the filtering logic.


Subsystem 4: TFT Speed Output

  1. Implement Absolute Difference Logic:
    • Subtract DisplaySpeed_Filter from DisplaySpeed using a Subtract block.
    • Pass the result through an Abs block to calculate the absolute difference.
  2. Compare the Difference:
    • Use a Compare To Constant block to check if the difference exceeds 1.5.
  3. Switch Between Outputs:
    • Use a Switch block:
      • Input 1: DisplaySpeed.
      • Input 2: DisplaySpeed_Filter.
      • Condition: Output of the comparison block.
  4. Add Output:
    • Add an Outport block and name it Vehicle_Speed_Display.
  5. Connect Blocks:
    • Connect the blocks to implement the logic.


Step 4: Verification and Validation Workflow


4.1 Requirement Traceability

  1. Use Simulink Requirements to document the four requirements (1.1 to 1.4).
  2. Link each requirement to its corresponding subsystem or block.


4.2 Testing Using Test Harness

  1. Create a test harness for the model:
    • Simulink Test > Test Manager > Create Test Harness.
  2. Define test cases:
    • Test inputs for Average_Vehicle_Speed in different ranges:
      • Below 2 kmph.
      • Between 2 kmph and 250 kmph.
      • Above 250 kmph.


4.3 Coverage Analysis

  1. Use Simulink Coverage to ensure all model logic paths are tested.
  2. Verify that:
    • All branches in the model are covered.
    • The filtering and output logic work as expected.


4.4 Code Generation

  1. Generate code using Simulink Coder.
  2. Perform Software-in-the-Loop (SIL) or Processor-in-the-Loop (PIL) simulations to validate the code.

Screenshot :

Attached

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.