Week - 4
Question 1)
- 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 & indicate through LED
- Soaking time should be 200s followed by Washing time of 100s.
- Then rinsing happens for next 20s & dryer runs for 50s
After all the processes have completed turn on the finished LED
sol:
Working principle of the washing machine:
A washing machine by spinning at 800 to 1600 rpm helps soap and dirt it to leave the surface of the cloth via centrifugal force and into outlet pipes hence utilising centrifugation to both clean and partially dry the clothes loaded in it. Does the process are electrically controlled, such as the drum, Valves, pump, motor and heating. The valve opens again and the dirty water drains out of the drum. The pump works to help get rid of water. The valve let’s clean water in again into the drum. There are four processes in the operation of the washing machine.They are:
- Soaking
- Washing
- Rinsing
- Drying
Control logic of a washing machine:
It checks for the extent of dirt and grease, the amount of soap and water to add, direction of spin, and so on. The machine rebalances washing load to ensure correct spinning. Else, it reduces spinning speed if any imbalance is detected. Even distribution of washing load reduces spinning noise.

The two inputs are given for the power and water supply. Once the inputs are given outputs are displayed by the flowchart as per the given sequence. The system is observed for some time then it is checked and process is completed by green light as displayed.
Results:







Question 2)
2. Make a Simulink chart for the “Gear shift” logic as per 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 & display the gear number.
sol:
Logic:
To controlling Washing machine system ON/OFF use Rocker switch. When the switch is ON all system are run and its indicate through Lamp. Then water start enter in machine if the water is not available then sysytem also OFF automatically and indicating through lamp water is available or not available. if available the go on next process soaking, washing, rinsing, drying after all process done end lamp will indicate the process is complete.
Blocks Used:
- Slider Switch
- Constant
- Display
- Stateflow Chart
- Lamp
- Slider block
- Custom guage
Simulink Model:

Stateflow Chart:

- The Stateflow chart is having two inputs which are speed and engine. The speed input is connected with a constant named "Accelerator speed" and engine input is connected with a constant named "Ignition ON/OFF" constant. The "Ignition ON/OFF" constant is connected to slider switch.
- In Stateflow chart, Checking ignition condition, we take "engine" as input Giving the condition as "engine==0" this will execute when the constant value is 0 that is when the vehicle is turned off and another condition as "engine==1" this will execute when the constant value is 1 that is when the vehicle is turned on.
- After the ignition condition is turned on the state flows to the next processes. Speed conditions are defined for each block. When it exceeds the speed condition the process flows to the next block. All the conditions have been assigned to each block.
- The Stateflow chart has two outputs named "a" and "b", these outputs are connected to the display blocks. The display block connected with the output "a" is named "GEAR INDICATOR" and the display block connected with the output "b" is named "OVERSPEED CONDITION".
- The "GEAR INDICATOR" display block displays the exact gear at which the vehicle is running. Five lamps have been connected to this display block in order to turn on the lamp for each gear ratio, that is done by assigning different state value for each lamp
- The "OVERSPEED CONDITION" display block displays the condition when the vehicle is attaining Overspeed situation.
Working Demostration:
At speed greater than 60:

At speed less than 15

At speed greater than 15

At speed greater than 25

At speed greater than 30

Result: