Week - 4
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
Solution:
Block models used for Washing machine implementation are below
Toggle Switch
Constant
Chart
Display
Lamp
The entire Washing machine implementation is shown below

Logic implemented in Chart is as below

When Power supply toggle switch is off i.e Power is not available

When power toggle switch is on but water toggle switch is off i.e Power available & water is not available

Both Power & water are supplied and so machine starts working and now the clothes are soaked for 200 seconds as given in problem

After soaking is done for 200 seconds,now the state is shifted to washing for 100 seconds

Clothes are washed for 100 seconds and now the rinsing starts as below

After rinsing the clothes for 20 seconds, the machinec changes it's state drying mode as below

Drying is carried out for 50 seconds and all the processes are completed and so turned on the finished RED LED light

Therefore Control logic of Washing machine is implemented using Stateflow as above.
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.
Solution
Gear shifting for the given conditions is implemented by using the following blocks
Slider
Display form dashboard
Constant
Chart
Display
Lamp
Control logic for Gear shifting is as below

The speed is varied using the slider block and the coresponding speed is displayed in Display block.
When the speed is between 0 and 15 kmph 1st gear is operated ,let speed = 10.26kmph

When the speed is between 16 to 25 kmph 2nd gear is operated,let speed =19.8 kmph

During the speed range of 26 to 40 kmph 3rd gear is operated, let speed=30.78 kmph

When the speed range is between 41 to 60 kmph the gear is shifted to 4th ,let speed= 45.1 kmph

If the speed is increased above 61 kmph gear is shifted to 5th,let speed= 61.8 kmph

Simulink chart for the given Gear shifting is implemented sucessfully as above and the Gears corresponding to the speeds are observed using the lamps. The speed is varied using slider and the conditions given in the question are satisfied upon implementation.