Week - 4
1.To implement control logic of a washing machine using stateflow in simulink.
Sequence given:
a)if the power supply is available,the system gets activated
b)if the water supply is not available,stop the process and indicate through LED
C)Soaking time should be 200s followed by washing time of100s
d)Then rinsing happens for next 20s and dryer runs for 50sec.
After all the processes have completed turn on the finished LED
MODEL:

In this model,
- When Lamp Shows Green,the task is in progress
- When Lamp Shows Red,the task ends
Chart,Display,Constant,Lamp and a Rocker switch blocks are used in this model.
The Chart Diagram Used in the model

NB:In this diagram 'en' refers for entry and 'ex' refers for exit.
The symbol pane:

In the diagram we have given two inputs,water supply and power supply.
Also we have given water,soak,washing,rinsing,dryer,cycle as the output.
Here 400 sec is used as simulation time to cover the whole cycle and sufficient time to store and solve the parameters.
LAMP PARAMETERS

Here '0 (RED)' refers task ends and '1 (GREEN)' refers the task is in progress
OUTPUT:
Condition 1:When water supply is off.
So here the water supply is not provided and output is recorded.

From the above result the lamp of water is showing RED,SO when there is no water supply the process is terminated and a lamp is used to indicate it.
Condition 2:When water supply is ON.
In this condition we are providing both water supply and power.

From the above result,all the states have been executed and the PROCESS COMPLETION(CYCLE) is showing Green.
So the simulation of WASHING MACHINE using State Flow is done.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.To make a Simulink Chart For The GEAR SHIFT Logic for the below mentioned Parameters:
Speed Range(kmph) Gear
0-15 1
16-25 2
26-40 3
41-60 4
Above 61 5
Model:

Here the blocks used are:
Chart
Display
Constant
Lamp
Rocker switch
Slider
From the slider block we can change the value of vehicle speed while simulation is running.

Logic

Here the speed ranges from 0-100 and the slider is used to give the input.
According to the conditions given the first gear has a speed from 0-15 so the entry condition for 1st gear is 0<=15 and the exit condition is speed is>15.
similarly for all other gears the entry and exit condition is specified and out is connected to the display block and then to lamp.
The symbol pane given:

The transition conditions for the gear shift is decided as
speed>15 G=2
speed>25 G=3
speed>40 G=4
speed>60 G=5
similarly in reverse direction
speed<60 G=4
Speed<40 G=3
speed<25 G=2
speed<15 G=1

From the parameters given to lamp,0 and GREEN indicates that the vehicle is not in that gear while simulation.
1 and RED indicates that the vehicle is on that gear while simulation.
Simulink model at different speeds
At speed=20kmph

Here the Red indicates that it is on 2nd gear at 20kmph.
At Speed=30kmph

Here the Red indicates it is on 3rd Gear at 30kmph.
At Speed 50kmph

Here the red indicates on Gear no 4.
AT Speed =72kmph

Here the red indicates on Gear no 5.so above 60 it will be on 5th Gear.
So all the conditions given are simulated through stateflow chart.
***********************************************************************************************************************************************************************************************************************************************************