Week - 4
- Task 1
- Aim -
Implement control logic of a “washing machine” using Stateflow as per given conditions.
- Objectives -
Given conditions for implement control logic of a washing machine-
1.If the power supply is available, the system gets activated
2.If the Water supply is not available, stop the process & indicate through LED
3.Soaking time should be 200s followed by Washing time of 100s.
4.Then rinsing happens for next 20s & dryer runs for 50s.
After all the processes have completed turn on the finished LED
- Washing machine model -

Explanation -
1.In washing machine model we are using 2 constant blocks which represents power supply and Water supply.This two blocks are connected with slider switch.
2.After that we are using state flow chart for washing machine control logic.Control logic chart includes water supply, soaking, washing, rinsing, drying, cycle as an output.
3.then we are using display block.all cycles are connected with display blocks for showing results.
4.All Display blocks are connected to lamp.Lamp are used for indicating washing machine cycle process.
- Chart Diagram of washing machine model-

Explanation -
In chart diagram first state, we are going to start cycle.After there is soaking process, as per given instructions soaking time should be 200sec.After soaking washing cycle starts.washing cycle is of 100 sec.Then rinsing cycle done in 20 sec and then dryer runs for 50 sec.Here we are giving simulation time of 430 sec to complete all cycles.
Parameters -

In parameter symbols,
Water supply and power supply is an input data.
Water,soaking,washing,rinsing,dryer and cycle are output data.
Output -
Condition 1 :
If the power supply is available, the system gets activated

Explanation -
When we provide power supply and water supply, all cycle starts to run.At last cycle indicator showing green signal this means process completion successfully done.
Condition 2 :
If the Water supply is not available, stop the process & indicate through LED.

Explanation -
When we not provided water supply ,all cycles get terminated .Check last indication (cycle) LED which is showing red signal this means Process is terminated.
- Conclusion -
We understood about how to implement control logic using state flow.By using state flow Simulink of washing machine is done succefully.
- Task 2
- Aim -
Make a Simulink chart for the “Gear shift” logic as per given conditions
- Objectives -
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
- Gear shift model -

Explanation -
1.In gear shift model, we are using 1 constant block and slider gain block for representing speed.We also providing speedometer for speed indication.
2.After that we took chart block for gear shift logic.Then we took display block which represents gear. For gear indication we inserted lamp.
3.When we change slider gain parameter (speed),speedometer will show the speed and gear block also shows gear no.After that lamp will show its colour as per given conditions.
4.Here, we gave simulation time as ‘inf’ (infinity) so that simulation will run continue until we stop.
- Chart diagram of gear shift model -

Explanation -
In chart diagram,
We had taken 5 state blocks for representing 5 gears.We provided conditions for each block as per given instructions.
Parameters -

Here , speed is an input data and gear is an output data.
Gear Indication color coding -
Speed Range(kmph) Gear Color indication
0 to 15 1 Yellow
16 to 25 2 Green
26 to 40 3 Blue
41 to 60 4 Purple
Above 61 5 Red
- Output -
Gear 1 -

Speed Range for 1st Gear - 0 to 15 kmph
Input speed - 10 kmph
Color indication - Yellow
Gear 2 -

Speed Range for 2nd Gear - 16 to 25 kmph
Input speed - 20 kmph
Color indication - Green
Gear 3 -

Speed Range for 3rd Gear - 26 to 40 kmph
Input speed - 30 mph
Color indication - Blue
Gear 4 -

Speed Range for 4th Gear - 41 to 60 kmph
Input speed - 50 kmph
Color indication - Purple
Gear 5 -

Speed Range for 5th Gear - Above 61
Input speed - 70
Color indication - Red
- Conclusion -
Simulink of Gear shift using state flow is done succefully. All results of gear shift model are satisfactory.
- Result Links -
1.washing machine model -
https://drive.google.com/file/d/18Wwkf2JXwPPFXdV3lwttITVm-iJZRGdw/view?usp=sharing
2.Gear shift model -
https://drive.google.com/file/d/1upahiu4BVwtj6e55L0-_h5SzcueG5Dpa/view?usp=sharing