Challenge

Week - 4

Aim: To implement the control logic of the Washing machine and Gear shift mechanism using Stateflow.

Objective: 

1. To implement control logic of a washing machine using Stateflow as per given sequence: 

- If the power supply is available, the system gets activated 

- If the water supply is not available, stop the process and indicate through LED

- Soaking time should be 200s followed by a Washing time of 100s

- Then rinsing happens for the next 20s and dryer runs for 50s

After all the processes have been completed turn on the finished LED

2. Make a Simulink chart for the "Gear shift" logic as per the below conditions:

Speed Range (kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5

Give speed input while the simulation is running and display the gear number.  

Part 1: 

Procedure/Steps:

1. Create a chart block for defining the Stateflow as per the given conditions.

2. Inside it, the circular junction is to terminate the signal flow and return a null value.

3. If power is OFF i.e. 0, the process is terminated at the junction else 1 is carried forwarded. 

4. If water is OFF i.e. 0, the process is terminated at the junction else 1 is carried forward. 

5. After this, the Soak block gets activated, and soaking action takes place.

6. After 200 sec of Soaking, the Wash block gets activated and the washing action takes place.

7. After 100 sec of Washing, the Rinse block gets activated and the rinsing action takes place.

8. After 20 sec of Rinsing, Dry block gets activated, and drying action takes place.

9. After 50 sec of dry, the Finish block gets activated. The Finish is to terminate the signal flow in the process and exits the chart.

10. Define power and water as inputs whereas soak, wash, rinse, dry, finish as outputs. 

11. Connect the chart block with constant blocks for power and water inputs. Input switches connected to them are a slider switch and a toggle switch respectively (to distinguish between the two). Attach lamps to observe the ON/OFF condition.

12. A common scope block is connected to observe the entire washing process and obtain the output plot. The Yellow color in the lamp indicates that the process is complete.

Below is the Simulink model for the given problem:

Stateflow:

Input: 

When Power is turned ON and Water is OFF

When Power is turned ON and Water is ON (at t = 0sec)

When Power is turned ON and Water is ON the soaking action is completed. (at t = 10sec) 

 

When Power is turned ON and Water is ON the soaking and washing action is completed. (at t = 230sec) 

When Power is turned ON and Water is ON the soaking, washing, and rinsing action is completed. (at t = 330sec) 

When Power is turned ON and Water is ON the soaking, washing, rinsing, and drying action is completed. (at t = 350sec)

When Power is turned ON and Water is ON the soaking, washing, rinsing, and drying action is completed. (at t = 500sec)

Part 2: 

Procedure/Steps:

1. Create a chart block for defining the Stateflow as per the given conditions.

2. Inside it, the circular junction is to terminate the signal flow and return a null value.

3. If the ignition is OFF i.e. 0, the process is terminated at the junction else 1 is carried forward. 

4. If speed is less than or equal to 0, the flow is terminated and gear 0 is activated. at the junction else 1 is carried forward.

5. If speed is greater than 0 and less than or equal to 15, the flow is terminated and gear 1 is activated. 

6. If speed is greater than 15 and less than or equal to 25, the flow is terminated and gear 2 is activated. 

7. If speed is greater than 25 and less than or equal to 40, the flow is terminated and gear 3 is activated.

8. If speed is greater than 40 and less than or equal to 60, the flow is terminated and gear 4 is activated. 

9. If the speed is greater than 60, the flow is terminated and gear 5 is activated.

11. Define ignition and speed as inputs whereas speedometer, scope, and gear number display as outputs. 

12. Connect the chart block with constant blocks for ignition and speed inputs. Input switches connected to them are a slider switch and a slider bar to adjust variable speeds respectively (to distinguish between the two). Attach lamps to observe the ON/OFF condition.

13. A common scope block is connected to observe the speed numerically and obtain the output plot.

A Simulink model for the given function is shown below.

Stateflow:

Input: 

When Ignition is turned ON and Speed is 0 the Gear Number displayed is 0

When Ignition is turned ON and Speed is 0 to 15, the Gear Number displayed is 1

When Ignition is turned ON and Speed is 16 to 25, the Gear Number displayed is 2

When Ignition is turned ON and Speed is 26 to 40, the Gear Number displayed is 3

When Ignition is turned ON and Speed is 41 to 60, the Gear Number displayed is 4

When Ignition is turned ON and Speed is 60 and above, the Gear Number displayed is 5

Conclusion: The above two cases of the washing machine and gear shift mechanism were executed on Stateflow and successfully simulated as per the given conditions.

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.