Week - 4
- 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
ANS:-
Following model shows the control logic of a "Washing Machine" using stateflow:

To create automatic washing machine logic i used chart function block from simulink & logic show below:-

Process:-
1) I create a chart block and inside the chart block i made state flow logic for washing machine by using states.
2) Then for the input of chart block gives the input from simulink and output to simulink. i have given 2 constant. 1 for power supply(input1) and another water supply(input2).
3) For the output i have used display for each condition. here we can use scope also as a output. i have given lamp also which is display will get signal 1 then that perticular dicided lamp will glow.
4) And get the result by hit the run.
Block used with functions:-
1) Chart:- in this chart we can creat the stateflow logic.it is an event driven system,the system respond to an event by making a transiton from one state to another state.
2) Constant:- the constant block generate the real or complex value signal.
3) Lamp:- for indication purpose only.
4) Display:- to get the result either 1 or 0 (ON/OFF).
For all condition like soaking,washing,rinsing etc. of lamp i have given different colours shown below:-
POWER ON- GREEN
WATER - RED
SOAKING - BROWN
WASHING - BLUE
RINSING - PURPLE
DRYING - YELLOW
FINISH - PINK
When we get the supply to the model the Power ON lamp will indicate Green shown below fig.

Now,if water is not available then we will see indication(RED colour) through "water_not_available" lamp.

Now,if water available then process is continue,after input2 is 1 then soaking lamp will glow(BROWN).shown below fig.(SOAKING TIME=200sec.)

Then after 200sec. will go for washing and washing lamp will glow(BLUE).shown below fig.(WASHING TIME =100sec.)

After 100sec.it going for rinsing and rinsing lamp will glow(purple).shown below fig.(RINSING TIME=20sec.)

then next 20sec. will go for drying and drying lamp will glow(YELLOW).shown below fig.(DRYING TIME=50sec.)

And last after50sec. finished process and Finish lamp will glow (PINK).

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.
ANS:-
Following model shows the GEAR SHIFT:-

Create the logic as per given condition in chart block as shown in below fig.

Following blocks are used in the model:-
1) chart:- In this chart we can creat the stateflow logic.it is an event driven system,the system respond to an event by making a transiton from one state to another state.
2) Constant:- the constant block generate the real or complex value signal.
3) Lamp:- for indication purpose only.
4) Display:- to get the result either 1 or 0 (ON/OFF).
5) Slider gain:- To varry the speed.
Now the speed in between 0-15kmph then gear is on 1st. and gear 1 lamp will glow.

whenever speed will increased in between 16-25kmph then gear will shift to 2nd and gear2 lamp will glow.

Then after if speed will increased again in between 26-40kmph then gear will shift from 2nd to 3rd and gear3 lamp will glow.

If speed is increased between 41-60kmph then gear will shift to 4th and gear4 lamp will glow.

And finally speed will increased above 61 then gear will shift last 5ft gear and gear5 lamp will glow as shown below here.

END