Challenge

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

Solution 1.

Here's a step-by-step guide to develop the Simulink model, create the SLDD (Simulink Data Dictionary) file, and perform V&V workflow for the wiper control system:


Step 1: Define the System Requirements

  • Inputs:
    • Rain density signal (simulated using a constant block with a knob).
  • Outputs:
    • Wiper motor speed in RPM (100 RPM, 200 RPM, or 500 RPM).
  • Conditions:
    • Low Rain Density → Output: 100 RPM.
    • Medium Rain Density → Output: 200 RPM.
    • High Rain Density → Output: 500 RPM.


Step 2: Design the Simulink Model

  1. Open MATLAB and Simulink:
    • Launch MATLAB and open Simulink.
    • Create a new blank model.
  2. Add Input Block:
    • Use a Constant Block to simulate the rain density input. Configure it to use a knob for real-time adjustments.
  3. Add a Switch Block:
    • Use Multiport Switch to define different rain density conditions:
      • Low → 1
      • Medium → 2
      • High → 3.
  4. Define Conditions:
    • Use Switch block and AND logic gate with Constant blocks to evaluate rain density.
    • Set thresholds:
      • Low Rain Density: 0–30.
      • Medium Rain Density: 30–60
      • High Rain Density: 60-100.
  5. Add Output Block:
    • Use a Constant or Lookup Table to define the RPM outputs (100, 200, and 500).
    • Connect the selected RPM to a Display Block and a Scope.
  6. Finalize Model:
    • Connect the selected RPM signal to a Scope or Display Block to observe output.
    • Add labels and organize blocks for clarity.


Step 3: Create SLDD (Simulink Data Dictionary)

  1. Open Data Dictionary:
    • Go to Simulink → File → New → Data Dictionary.
  2. Define Parameters:
    • Add parameters for rain density and RPM outputs:
      • RainDensity (input, type: double).
      • WiperSpeed (output, type: double, values: 100, 200, 500).
  3. Link to Model:
    • In Simulink, go to File → Model Properties → Link to Data Dictionary.
    • Link the created SLDD file.


Step 4: Perform V&V Workflow

  1. Requirements-Based Testing:
    • Define test cases for each rain density condition (low, medium, high).
    • Use a Test Sequence block or Simulink Test to create scenarios.
  2. Model Coverage Analysis:
    • Run simulations with test cases.
    • Analyze model coverage using Simulink Coverage.
  3. Static Verification:
    • Use Simulink Design Verifier to check for unreachable states or dead logic.
  4. Dynamic Verification:
    • Observe simulation results to verify outputs match requirements.
    • Save scope output for documentation.
  5. Generate Report:
    • Generate a verification and validation report using Simulink Report Generator.


Final Notes

  • Save the Model:
    • Save the Simulink model as WiperControlSystem.slx.
  • Documentation:
    • Include block diagram snapshots, test results, and coverage reports in the project documentation.

Screenshot:

Attached

Solution 2:

Step 1: Create the Simulink Model

1.1 Add Input Blocks

  1. Open Simulink and create a new model by selecting File > New > Model.
  2. From the Simulink Library Browser, drag four Inport blocks into the workspace.
  3. Rename the blocks as:
    • fl (Front Left Wheel Speed)
    • fr (Front Right Wheel Speed)
    • rl (Rear Left Wheel Speed)
    • rr (Rear Right Wheel Speed)


1.2 Add Conversion Blocks

  1. Drag and drop four Gain blocks from the Math Operations library.
  2. Set the gain values in each block to:

2πr/60​

where r is the wheel radius (define this as a parameter in an SLDD file, e.g., Wheel_Radius).

Example Gain value: 2π×0.3 ≈ 0.0314

  1. Connect each Inport to a corresponding Gain block.


1.3 Compute the Sum of Linear Speeds

  1. Add a Sum block from the Math Operations library.
  2. Configure the Sum block to accept four inputs by setting the input parameter to ++++.
  3. Connect the outputs of the four Gain blocks to the Sum block.


1.4 Calculate the Average Speed

  1. Add another Gain block to divide the sum by 4.
    • Set the Gain value to 1/4.
  2. Connect the output of the Sum block to the Gain block.


1.5 Add Output Block

  1. Add an Outport block from the library and rename it to Vehicle_Speed.
  2. Connect the output of the Gain block to this Outport.


1.6 Add Stateflow for ABS Logic

  1. Add a Stateflow Chart block from the Stateflow library.
  2. Design the Stateflow chart with:
    • Input Variables: Linear speeds from the wheels (fl_speed, fr_speed, rl_speed, rr_speed).
    • Output Variables: Valid wheel speeds for averaging.
    • Logic:
      • Compare each wheel speed to the calculated vehicle speed.
      • If a wheel deviates beyond a threshold (Deviation_Threshold), exclude it from the averaging process.
  3. Connect the Stateflow chart outputs to the Sum block for valid speeds.


1.7 Model Finalization

  1. Save the model as ABS_Vehicle_Speed_Calculation.slx.
  2. Save the data dictionary (SLDD) file as ABS_Speed_Data.sldd and link it to the model.


Step 2: Link SLDD File

2.1 Create SLDD File

  1. Open the Model Explorer and create a new data dictionary:
    • Go to File > New > Simulink Data Dictionary.
    • Save it as ABS_Speed_Data.sldd.

2.2 Define Parameters in SLDD

  1. Add the following parameters:
    • Wheel_Radius: (e.g., 0.3 meters)
    • Deviation_Threshold: (e.g., 2 m/s)
  2. Link the SLDD file to the Simulink model:
    • Go to File > Model Properties > External Data and add the SLDD file.


Step 3: Verification and Validation Workflow

3.1 Requirement Linking

  1. Use Simulink Requirements to document requirements for the system (e.g., speed calculation, ABS logic).
  2. Link requirements to specific blocks and Stateflow states.


3.2 Simulation Testing

  1. Create a test harness using Simulink Test:
    • Go to Analysis > Test Manager > Create Test Harness.
  2. Simulate various scenarios, such as:
    • Normal driving conditions.
    • Slipping wheels (one or more wheels deviate significantly).
    • All wheels locked.


3.3 Model Coverage

  1. Use Simulink Coverage to analyze the model.
  2. Ensure that all logical paths in the Stateflow chart and model blocks are covered during simulation.


3.4 Fault Injection Testing

  1. Simulate sensor faults using Test Manager:
    • Introduce faults like zero speed or large deviations.
  2. Verify that the model excludes faulty sensors and calculates speed correctly.


3.5 Code Generation and Testing

  1. Generate code using Simulink Coder.
  2. Validate the code against the model to ensure functional equivalence.


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.