Week - 4
AIM:
1. To implement a control logic of a "washing machine" using stateflow as per the given sequence:
a) If the power supply is available, the system gets activated.
b) If the supply is not available, stop the process & indicate through LED.
c) Soaking time should be 200s followed by washing time of 100s.
d) Then rinsing happens for the next 20s & dryer runs for 50s.
e) After all the processe have completed turn on the finished LED.
2: Make a simulink chart for the "Gear shift" logic as per the below conditions:
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 the speed input while the simulation is running & displays the Gear numbers.
Explaination:
A) Control logic: Control logic is a model system logic of a washing machine using state flow.
B) State flow: Stateflow provides a graphical language that includes state transition diagrams, flowcharts, state
transitions tables. By using state flow to describe how Matlab algorithms and simulink models react to input
signals, events, and time-based conditions.
MODEL 1: Explaination 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 tasks performed by machine is based on the centrifugation. It is a separation
process that used centrifugal force to promote accelerated setting 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 rotates very quickly to make the water remove the dirt from the clothes,
these can help make the clothes cleaner.
Given data:
The different states of washing machines,
1. Soaking- 200sec (0-200sec)
2.Washing-100sec(200-300sec)
3. Rinsing-20sec(300-320sec)
4. Drying-50sec(320-370)
5. Completed
MODEL:
STATEFLOW:
BLOCK USED IN MODEL:
1. Constant - For water and power supply.
2. Lamp - To indicate the signal.
3. Slider switch - To turn ON and OFF the machine.
4.Stateflow - For control logic.
5. Display - To show the output signals.
PROCEDURES:
1. 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.
2. 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.
3. When both water and power are at 1 then the socking process starts and run for 200sec after this washing
is started.
4. After 200sec the rinsing process starts. and after this process drying process is started for which the water
supply is cut off.
5. After completing all the tasks, the macine turns off.
6. For all the different process or states of the machine the lamp indicates green for working and red for not working.
This gives a better idea to the user, now which process is going in the machine.
DIFFERENT STATES OF THE MACHINES:
SOAKING:
WASHING:
RINSING:
DRYING:
2.
Draw a 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 main shafts and rotate it. Thus the main
shaft rotates or the speed of engaged gear and provides the output as per the gear's ratio. Shifting of gear 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 increased the speed.
GIVEN DATA:
1. 1st gear - (0 to 15 kmph)
2. 2nd gear - (15 to 25 kmph)
3. 3rd gear - (25 to 40 gear)
4. 4th gear - (40 to 60 kmph)
5. 5th gear - (Greater than 60 kmph)
MODEL:
STATEFLOW:
MODEL OF GEAR SHIFT CONTROL LOGIC:
BLOCKS USED IN THE MODEL:
1. Constant: To multiply with the slider gain.
2. Slider gain: It acts as a throttle to increase and decrease the speed.
3. Lamp: It indicates the gear number's LED.
4. State flow: Control logic of gear shifting.
5. Display: It indicates the gear no.
PROCEDURE:
1. At the initial position, the slider is at 0.
2. When we increased the speed the input is given to the state flow chart where it checks input speed
and the displays the gear number.
3. According to the given data the range of the 1st gear is 0-15kmph.
4. The range of the 2nd gear is 15-25kmph.
5. The range of 3rd gear is 25-40kmph.
6. The range of 4th gear is 40-60kmph.
7.The range of the 5th gear is greater than 60kmph.
At 1st gear:
At 2nd gear:
At 3rd gear:

At 4th gear:
At 5th gear:
CONCLUSIONS:
1. The simulation of washing machine using state flow is done and result is satisfactory.
2. Created a state flow for gear shift using simulink and the result is satisfactory.