Week - 4
AIM 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
SOLUTION:
1) WORKING OF WASHING MACHINE:
A washing machine is a home appliance used to wash laundry. The term is mostly applied to machines that use water as opposed to dry cleaning or ultrasonic cleaners. The user adds laundry detergent, which is sold in liquid or powder form, to the wash water. No physical efforts are required to do the task. The washing machine enables you to wash your clothes automatically without having to supervise its operation. All you have to do is put the clothes in the machine and select the wash mode. The washing machine automatically takes in the amount of water and detergent required and it also automatically sets the timer for washing, rinsing and drying as per the selected mode and the amount of clothes.
TYPES OF WASHING MASHINE:
1) Semi-automatic washing machine: This has separate tubs or vessels for the washer and the drier. There are two separate timers that enable setting washing and drying times. To wash the clothes you have to put the clothes in the wash vessel, put sufficient quantity of the water and detergent and then set the timer. After the specified time, the washing machine will stop. You can remove the clothes and dry them in the sun or you can dry them partially in the drier vessel by setting suitable time.
2) Fully automatic machine: In fully automatic washing machine there is only one tub that serves as the washer, rinser as well as the drier. Depending on the number of clothes or the weight of the clothes, the machine takes in the sufficient amount of water and detergent automatically and sets the timer for wash and drying automatically. All you have to do is just provide the water connection, put the detergent from time-to-time in its storage space and put the clothes, the fully automatic washing machine does the rest of things automatically.
BLOCKS USED ARE:
- Chart
- Rocker Switch
- Scope
- Lamp
- Constant
LOGIC EXPLAINATION:
1)use chart block to create logic for the washing machine.

Also define the variable as show in the below picture from Modelling and select symbols pane.
SYMBOLS PANE

1) first state is power supply stage. this state will check if power supply . this means that, if power supply is present then only process will go to the next state.
if power supply is absent, then the process stops there itself.
2)Next stage is the water input stage. In this stage, the water is filled in the washing machine tank.
this stage checks logic that if water is there i.e. if water==1, then only proceed to next stage , otherwise if water==0 then go to end machine stage.
3)if water==1, then soaking stage occues. here cloths that are placed in washing machine drum is soaked with water for 200 seconds as per question.
4) after 200sec , washing stage occurs . here in this stage , cloths are washes by revolving in clockwise and anticlockwise direction by motor.
5) as per given question , washing should be done for 100 seconds. thus after 100 seconds , rinsing stage comes.
6) in this rinsing stage , water is taken out from the drum of washing machine.as per given question , rinsing should be done for 20 seconds.
7)then comes drying stage. here cloths are dried . as per given question ,this process should occur for 50 seconds .
8) if we comes to the main model, we have two inputs like power and water.
9)rocket switch is used to make power and water supply on and off.
10)
if power is on, and water is on , then process starts,
a)intially, at 0 second means at starting, all lamps are red,
b) after 200 seconds , soaking process gets end , thus soak lamp turns green.

c)when soaking stage gets complete, then after 100 seconds , washing stage gets completed. thus wash lamp also turns green.

d)then when washing stage gets over , then rinsing stage appears. this rinsing stage appears for 20 seconds as per the given question.

e)then after rinsing stage , there occur drying stage for 50 seconds.. thus after completion of drying stage, dry lamp glows green.

f) after completing all the process, end lamp will glows green.

11)if power is on , and water supply is off
then no process occurs .directly the process comes to last end stage.

AIM 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.
SOLUTION:
GEAR MECHANISM:
Gear Lever
⦁ 1. Modern cars have 5 forward gears and 1 reverse gear. Practise changing gears from the first to the fifth and backwards.
⦁ 2. To change gears, press down on the clutch and follow the pattern of the gear lever.
⦁ 3. Then learn to shift between gears. From 1st to 2nd, from 1st to 3rd and so on.
⦁ 4. Shifting between gears is important when you are driving long distances or in traffic, since you have to gauge the distance from the car ahead.
GEAR SHIFTING MECHANISM

BLOCKS USED ARE:
- slider gain
- constant
- rocker switch
- chart
- display
- lamp
SIMULINK MODEL:

GEAR SHIFT LOGIC CHART

SYMBOLS PANE

SLIDER GAIN: To change the speed of the vehicle manually.

SPEED REPRESENTATION THROUGH COLORED LAMPS

0 to 15 blue=gear1
16 to 25 orange=gear2
26 to 40 yellow=gear3
41 to 60 purple=gear4
Above 61 green=gear5
STOP TIME= INF
WORKING:
when the power is zero or no input is provided the lamp turns to red, thus process ends.

As asked in the question shifting gears at different speed
- when speed is between 0-15 its runs on gear1

- when speed is between 16-25 its runs on gear2

- when speed is between 26-40 its runs on gear3

- when speed is between 41-60 its runs on gear4

- when speed is above 60 its runs on gear5

Result:
