Week - 4
AIM:
1.To Implement a control logic of a "washing machine" using Stateflow as per the 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 the next 20s & dryer runs for 50s
- After all the processes have completed turn on the finished LED
2.Make a Simulink chart for the "Gear shift" logic as per the below
Speed Range(km/h) 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.
EXPLANATION:
State flow:
Stateflow provides a graphical language that includes state transition diagrams, flowcharts, state transition tables. by using state flow to describe how Matlab algorithms and Simulink models react to input signals, events, and time based conditions.
control logic:
control logic is a model system logic of a washing machine using state flow.
MODEL1:
Explanation for Control logic of a "washing machine" using State flow
WASHING MACHINE:- It is a machine which is capable of handling various tasks like soaking, washing, rinsing, drying within a short period of time. all the task performed by machine is based on the centrifugation. It is a separation process that used centrifugal force to promote accelerated settling of the particle in the solid or liquid mixture.
In other words, a washing machine is a machine that washes dirty clothes.it contains a barrel into which the clothes are placed. this barrel is filled with water and then rotates very quickly to make the water remove the dirt from the cloths. these can help make the clothes cleaner.
given data:
the different states of washing machines
- Soaking-200sec (0-200sec)
- Washing-100sec (200-300sec)
- Rensing-20sec (300-320sec) Drying-50sec (320-370sec)
- Completed
Model:

Stateflow :

Block Used in Model
- Constant:-for water and power supply
- Lamp:-to indicate the signal.
- Slider switch:-to turns the machine on and off.
- Stateflow:-for control logic.
- Display:-to show the output signals.
Procedure:
- the power and water supply to the machine are dependent upon the switch conditions which is on or off and it is defined by the constant value 0 or 1.
- the signal with the given state flow logic. if the value displayed is 1 then the power and the water supply to the machine. if the value is 0 and 1 then the machine will not start the process as one of the switches is off.
- when both power and water are at I then the soaking process starts and run for 200 sec after this washing started.
- after 200sec the rinsing process starts. and after this process, the drying process is started for which the water supply is cut off.
- after completing all the tasks, the machine turns off.
- for all the different process or states of the machine. the lamp indicates green for working ad red for not working. this gives a batter idea to user, now which process is going on in the machine..
Different states of the model:
Soaking:

Washing :

Rinsing :

Drying :

MODEL 2:
Draw Simulink chart for the "Gear shift" logic as per the given conditions:
when we push the shifter towards the desired gear the gear looks into the man shaft and rotates it. thus the main shaft rotates at the speed of engaged gear and provides the output as per the gear's ratio. shifting of gears means going from one gear to another by sliding or clicking the shifter. Downshifting means going to lower gears and decreasing the speed and upshifting means going to a higher gear and increase the speed.
Given data :
- 1st gear - (0-15kmph)
- 2nd gear - (16-25kmph)
- 3rd gear - (26-40kmph)
- 4th gear - (41-60kmph)
- 6th gear - (above 60kmph)
MODEL:

Stateflow:

Blocks used in the model:
- Constant - To multiply with the slider gain.
- Slider gain-It acts as a throttle to increase or decrease the speed.
- Display-For indicating the gear number.
- State flow-control logic of gear shifting.
- Custom gauge - it's working as the speedometer of the vehicle means to show the speed of the vehicle.
- Scope-To plot the graph of the speed vs gear shift.
PROCEDURE:
- At the initial position, the slider is at 0.
- when we increased the speed the input is given to the state flow chart where it checks the input speed and displays the gear number.
- according to the given data the range of the first gear is 0-15kmph.
- the range of the second gear is 15 25kmph.
- the range of the third gear is 25-40kmph.
- the range of the fourth gear is 40-60kmph.
- the range of the fifth gear is greater than 60kmph.
At 1st gear:

At 2nd gear:

At 3rd gear:

At 4th gear:

At 5th gear:

Output:

CONCLUSION :
From the output, we can say that the gear shifting takes place according to the given speed input.