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.
Answer :
1. Create a chart and give the input conditions to it.
2. After that give the conditions for turning on and off power supply and water supply as follows,
if value = 1 then power supply and water supply will turn on
if value = 0 then power supply and water supply will turn off.
Display block and lamp indicators are used to indicate results.

Outputs for washing machine :
Case 1 :-
If power source = 0 , then power supply is not available and system if off.

Case 2 :-
If power source = 1 and water source = 0 , then power supply will turn on and water supply did not turn on so system will not activate.

Case 3 :-
If power source = 1 and water source = 1, then both power supply and water supply will turn on , so system will be activate.

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.
Answer :
1. Create a chart and enter given inputs.

2. By using symbol pane assign the given variables.
3. Connect slider gane to varry speed .
4. Connect constant to varries conditions.
5. Display blockis used to display gear number.

Outputs for gear shift logic :-
Case 1 :-
If the key = 0 , then power will turn off, so gear mechanism will not activate.

Case 2 :-
If the key = 1 , then power will tuen on and so gear shifting mechanism will activate.

Case 3 :-
If the key = 1 and we change the speed by changing value in slider gain, speed will be increased.
