Week - 4
AIM:
- 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
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.
PROCEDURE:
WORKING PRINCIPLE OF A WASHING MACHINE:
A washing machine by spinning at 800-1600 rpm helps soap and dirt with it to leave the surface of the cloth via centrifugal force and into outlet pipes hence utilizing centrifugation to both clean and partially dry the clothes loaded in it. Thus the processes are electrically controlled, such as the drum, valves, pump, motor and heating. The valve opens again and the dirty water drains out of the drums. The pump works to help get rid of the water. The valve lets clean water in again into the drums. The four process are:
SOAKING:
It is used to dip clothes in detergent water to remove dirt from the clothes. In this function customer need to select soak from a panel. Soak - This function is available with wash timer, In 42 min of washing 27 min is soak and 15 min machine will wash the clothes.
WASHING:
During the wash cycle, a large plastic agitator (green) turns around, moving your clothes through the water. When the wash is finished, the pump drains the water from the outer drum.
RINSING:
The dirty, soapy water is drained, then the washing machine is refilled and your clothes are "rewashed" in clean water. Spin: All the water is drained completely, then your clothes are spun very fast and excess water is removed thanks to centrifugal force.
DRYER:
They work by pushing warm dry air through your wet washing to extract moisture, then cooling the now humid air in a heat exchanger to condense the moisture, which is collected in a tank or pumped down the drain. The (now dry) air is reheated and the cycle repeats.
1) STATE-FLOW:
Systematic solution of a problem is possible with sequential, unambiguous and realizable finite process step set. This set is called “algorithm” and it is one of the most important part of the programming languages. In this study, it is represented how to learn algorithm by using Simulink Stateflow. In flow diagram-based algorithm learning.
CONTROL LOGIC OF A WASHING MACHINE:
It checks for the extent of dirt and grease, the amount of soap and water to add, direction of spin, and so on. The machine rebalances washing load to ensure correct spinning. Else, it reduces spinning speed if an imbalance is detected. Even distribution of washing load reduces spinning noise.

The two inputs are given for the power and water supply. Once the inputs are given outputs are displayed by the flow chart as per the given sequence. The system are observed for sometime then it is checked and the process is completed by green light as displayed.

2) GEAR SHIFT LOGIC:
A gear shift mechanism for a manual transmission includes a shaft axially movable for selecting shift planes and rotatable for engaging the gears defining the shift planes. The shaft is held in a reference shift plane by two helical springs.

RESULTS:
1) Thus the control logic of a washing machine using stateflow is processed as per the given sequence and LED lights are turns to the green colour and the system is completed.
2) A simulink model is created for the gear shift logic and using slider gain the values are obtained.
Question 1:-
- 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
Answer:-
Logic:- To controlling Washing machine system ON/OFF use Rocker switch. When the switch is ON all system are run and its indicate through Lamp. Then water start enter in machine if the water is not available then sysytem also OFF automatically and indicating through lamp water is available or not available. if available the go on next process soaking, washing, rinsing, drying after all process done end lamp will indicate the process is complete.
Stateflow chart:-

In the above control logic first created two states 1] Power==1 /Power==0 its use for activation of supply to system. Power==1 it means Power on and Power==0 it means Power off.
2] W==1/W==0 its for to know water is available or not. When both are activate then machine start to process run.
Then next four states are created for the flow order of the Soaking, Washing, Sinking, Drying with their time of operation for soaking 200 sec, for washing 100 sec, for rinsing 20 sec and for drying 50 sec.
Then create exit condition of the state kept as zero. at the enter of state then the operation state is zero and when its complete the is one.
after all process done then its all shows through Lamp, and then we can shut the machine off.
Symbol Pane:-

In this symbol pane we created Output of power start, water start, soaking, washing, rinsing, drying and input as power switch, water switch for displaying output. they connect to display block.
Model:-
1]

In this model the power switch and water control switch are off so they are shown through lamp. red light is on it means full system is off. and when the system is off then also constant input is 0.
2]

In this model the power switch is on and water control switch is off when water control switch is off the n the all system also off.
3]

In this model the power and water control switch are on so full system are run and they indicate through lamp. It completes a cycle through as first soaking for 200 sec then washing for 100 sec and then the use water goes out from machine new fresh water enter in machine it all shows through lamp indicator then rinsing will be done for 20 s and the drying for 50 sec and then the cycle is end and it also indicate through lamp.
Question 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.
Answer:-
In this system mainly used as slider block. It is used for the given input to speed.
Logic:-
In this system given speed range is 0-100 so we use slider block for the given input speed. The first gear speed range is 0 to 15 so the entry of state for the 1st gear is 0<=speed and 15>=speed it is the exit condition of gear in speed greater than 15. In gear 2 entry state is 16<=speed and 25<=speed the exit condition is between speed<16 to speed<25.Same conditions are applied in all gears and the output is gives from lamp and dispaly block.
Stateflow Chart:-

In the above flowchart first start the engine creating input switch E=0/1 through rocker switch which is gives the powerto engine. then next gear shift logic is implemented through following states. The five gear states are created in system as gear 1,2,3,4,and 5 rsesp. and their trasition is connected with speed range condition is shown below
The gear transition is decided below
Speed>15 shift to G=2
Speed>25 shift to G=3
Speed>40 shift to G=4
Speed>60 shift to G=5 when the speed increasing from 0-60kmph simillarly in reverse direction as same.
while simulating gear shifting logic engine E==0 condition given to various speed change values.
Symbol pane:-

In this output as gear_first, Gear_second, Gear_third, Gear_fourth, Gear_fifith and the input is E, and speed.
Models:-
1]

In this model we shown when the engine start and the speed is goes to 5kmph then the model shown at that speed the engine is it at 1st gear it is indicated through lamp.
2]

In this model speed is 20kmph and it is in 2nd gear the see the only second lamp is on.
3]

It is at speed nearly 45kmph at engine in 3rd gear and glow green light and display output as 1.
4]

In this model the speed of engine is at above 60 then the gear is implemented as 5th and the green light was on and in display block showing 1.
hence all condition are simulated through stateflow chart successfully.
Thank You