Week - 4
Answer 1:
WASHING MACHINE USING STATEFLOW
Aim:
To 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.
We have to create a simulink model and operate the model logic system and display the output of the results using the lamp indicators.
Stateflow is a simulink tool to implement the state machine.Here model system logic of a washing machine using state flow has been done.
First of all we have to create a chart and enter the above given input conditions.
The chart for stateflow is shown below:
Enter the input conditions in the chart and go to symbols pane and assign the input and output given variables.

Given the input values for turning on and turning off the power supply and water supply according to given conditions:
- If value=0,Power supply and water supply will turn OFF
- If value=1,Power supply and water supply will turn ON
Use the display block and lamp indicator for displaying the results.
Simulink model :

Case 1:
Power source is not given,Water source is not given

Case 2:
Power source is not given,Water source is given

Case 3:
Power source is given,Water source is not given

Case 4:
Power source is given,Water source is given:
After all the process is done the process completion indication lamp will glow.

Result:
Implemented the control logic for washing machine using stateflow and the outputs for different conditions are verified.
Answer 2:
Simulink chart for GEAR SHIFT
Aim:
To 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.
Create a simulink chart and enter the above given conditions for the gear shifting:

Now enter the input conditions in the chart and go to the symbols pane and assign the given input and output variable.
Connect a slider gain and set the initial value as 0 and final value as 200.It acts as a accelerator in the car whose speed in kmph is varying from 0 to 200kmph.Also connect a constant block named 'key' with accelerator for starting and stopping the engine.If the value of key is 0 it means engine is OFF, if 1 engine is ON.Here we have connected a lamp for whether the engine is ON or OFF.If green is glowing it means ON and if red its OFF.Also a engine symbol is used for indication.Here a display is connected to the position output of the simulink chart to indicate the cuurent position of the gear.Also I have attached a dashboard display to show the gear position.
Case 1:
If key=0,then power is turn off,gear shifting mechanism will not activate.

Case 2:
If key=1,the power will turn ON,green light will glow and the accelerator value is 0,gear position shows 0 which means it is neutral.

Case 3:
If key=1,the accelerator value is >0 and <=15,the gear position shows 1

Case 4:
The accelerator value is >15 and <= 25,the gear position will show 2

Case 5:
The accelerator value is >25 and <=40,the gear position shows 3

Case 6:
The accelerator value is >40 and <=60,the gear position shows 4

Case 7:
The accelerator value is >60,the gear position will show 5

Result:
Thus simulink chart for gear shifting is designed and simulink model is created and for different values of speed the gear position is also changed accordingly and the outputs are verified.