Week - 4
- 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:-
WORKING PRINCIPLE OF A WASHING MACHINE:
A washing machine by spinning at it's respective 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 needs to select soak from a panel.
WASHING:-During the wash cycle, a large plastic agitator 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 by 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 air is reheated and the cycle repeats.
STATE-FLOW:
Stateflow provides a graphical language that includes state transition diagrams, flow charts, state transition tables, and truth tables. Stateflow can use to describe Matlab algorithms and Simulink models react to input signals, events, and time-based conditions.
Modeling of Washing machine in Simulink:
these are the following things we need for modeling the subs system of washing machine logical block settings:
1. Toggle switch:-for On and Off purpose of Power and Water, we use this Toggle Switch.
2. State flow chart:- for providing logic and condition of working.
3. Lamps:-For sign purpose, is Activity is done then it's green if not then red.
4. Display:- for displaying output.
Simulink Model of Washing Machine:

a)1st condition:-If the power supply is available, the system gets activated
As we can see in above fig.,Toggle switch of power is ''ON" means machine getting power and in display its showing 1 and lamp is also glowing green, means as power supply is available,the machine get activated.
b)2nd Condition: If the Water supply is not available, stop the process & indicate through LED.

here, as we can see in above fig, Power is ON but water is not available, so water lamp glows red and also rest of the process like soaking, washing..etc stop and there lamps also glows red.
c)Our 3rd ans 4th condition:-
- Soaking time should be 200s followed by Washing time of 100s.
- Then rinsing happens for next 20s & dryer runs for 50s

Here in above fig of state flow chart, we can see the condition, after 200sec, of soaking, the machine will go for washing and after 100sec, the M/c will jump for further next rinsing state and 20 sec of rinsing, the M/c will go next for drying state and 50sec it will finish.
d)our last condition:-After all the processes have completed turn on the finished LED

As we can see here, Power and Water both are ON and after running with it's respective time period, we can see all lamps are glowing green, means all the process is done perfectly and job is completed.
Q2. 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:-
Simulink Model of Gear shift.

Here we use, Slider Gain for increasing or decreasing the speed, simulink Chart of providing condition to gear box and scope and display for result.
Simulink chart for the “Gear shift”

as we can see in above fig simulink chart for gear shift is according to question condition, means
Speed Range(kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5
Now,speed input while the simulation is running & display the gear number.
when Speed is let's say 14 kmph, which is in range of (0 to 15)kmph,
in Display, it's showing Gear number "1".

When Speed is 24 kmph means between (16 to 25) kmph.
we can see in display, it's showing Gear number "2".

When Speed is 39 kmph means, between (26 to 40)kmph,
we can see in display, it's showing Gear number "3".

When Speed is 59 kmph means, between (41 to 60)kmph,
we can see in Display, it'showing Gear number "4".

And when Speed is 62kmph means, above 61kmph, we can see the gear number is "5".

Now we can see in graph of Scope...the shifting of gear number as per speed.
