Week - 4
Challenge: Week 4
1. Control logic of a washing machine:
Objective:
- If power supply is available --> system gets activated
- If water is not available --> stop process --> indicate through LED
- Soaking time --> 200s, Washing time -->100s
- Rinsing time --> 20s, Drying time -->50s
- After process is completed --> turn FINISHED LED on.
Logic:
Stateflow: State-flow provides a graphical language that includes state transition diagram, flowcharts, transition tables and truth tables.
Stateflow:
- Start
- Soak-->0 - 200 seconds (200)
- Wash-->200 - 300 seconds (100)
- Rinse-->300 - 320 seconds (20)
- Dry-->320 - 370 seconds (50)
- Finish
Total process run time:370 seconds. The model stop time is set to 1000 seconds
Simulink model:

Stateflow/Control logic:

Explanation:
- The stateflow of the machine is set in the chart of the model
- Toggle switches are provided to turn the water and power ON and OFF.
- The system is set such that both power and water is required to complete the process.
- The state timings for soak, wash, rinse and dry are defined in the chart and once all the process are completed, a lamp will flash with the wash complete signal.
- If the water supply is not available, the process will be terminated.
Result:
Power OFF, water OFF

Power ON, water ON

Simulink blocks used:
- Slider switch
- Constant block
- Chart
- Lamps
- Display block