Week - 4
1. Aim : To implement control logic of a “washing machine” using Stateflow in Simulink.
Objective :
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.
Block Diagram :

Explantion :
- In these model we use stateflow chart to create control logic for washing machine. We used two switches to operate power & water supply.
- Lamps are used to watch power & water supply state which is ON or OFF. The switches & lamps are connected to constant block. Constant block is connected with control logic.
- All process ports are connected with display block & display block is connected with lamp to watch the process of washing machine w.r.t given time.
- We run these simulation for 400 sec.
Control Logic Block Diagram :

Explantion :
- In the above figure, the starting (first) state is created with two transition conditions i.e. first is power supply which is equal to 1 & second is water supply which is also equal to 1. That means both power & water supply are on.
- The second state is soaking, in these state the water supply is required so we have given the water supply. After completion of soaking & water supply are off. As per given condition we gave time 200 sec for these process with the help of transition condition.
- The third state is washing, in these state only washing is done with already available water in washing machine, as per given condition we gave 100 sec for these process from transition condition.
- The forth state is rinsing, in these state the repeated washing is happened, so we required water supply in it. The water supply is off after 20 sec & rinsing state also done as per given transition condition.(In these state, we are using water supply which is not given in condition)
- The fifth state is dryer, in these state the cloths are dry in 50 sec as per given transition condition. After completion of process dryer would off with the help of state condition.
Parameters :

Input Data - power_supply & water_supply.
Output Data - water, soaking, washing, rinsing, dryer, cycle.
Output :
First condition, when Water supply is OFF.

From above figure, we can see that indicator of water is Red i.e. when there is no water supply the process is terminated & lamp indicator is used to indicate that state.
Second condition, when Water supply is ON.

From above figure, we can see that all states have been executed & indicating the end cycle is Green.
Simulink Model Link : https://drive.google.com/file/d/1ojwpuWYJK9QUULibuwVY6xKVwV2SltvU/view?usp=sharing
2. Aim : Make a Simulink chart for the Gear shift logic.
Objective :
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.
Block Diagram :

1. In these model we use stateflow chart to create control logic for gear shifting.
2. We use slider gain to provide the input to the control logic, it is connected from constant block.
3. The output of control logic (name given is gear) is connected to display block. And display block is connected with lamp to watch the process of gear shifting w.r.t given time.
Control Logic Block Diagram :

As per given condition for gear shifting, we have create stateflow diagarm with the help of transition condition w.r.t speed.
Parameters :

Input Data - Speed
Output Data - Gear
Output :
The output produced is recorded when it is displaying the each gear.
Gear - 1 :
Speed range : 0 to 15 kmph
Input Speed : 10 kmph
Color : Green

Gear - 2 :
Speed range : 16 to 25 kmph
Input Speed : 20 kmph
Color : Blue

Gear - 3 :
Speed range : 26 to 40 kmph
Input Speed : 30 kmph
Color : Orange

Gear - 4 :
Speed range : 41 to 60 kmph
Input Speed : 50 kmph
Color : Yellow

Gear - 5 :
Speed range : above 60 kmph
Input Speed : 70 kmph
Color : Violet
Simulink Model Link : https://drive.google.com/file/d/1PoJulZgWHGECoNiHZmJXNe9iLwRqisQk/view?usp=sharing