Week - 4
AIM : To implement control logic of a washing machine using stateflow in simulink.
OBJECTIVES :
OBJECTIVE 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
OBJECTIVE 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.
MODEL :
OBJECTIVE 1 - Stateflow chart :
A Finite state machine is a representation of an event driven system. In an event driven system that system responds to an event by making a transition from one state to another. This transition happens in the condition provided is true. A state flowchart is a graphical representation of a finite state machine.
Stateflow chart for a washing machine :

Explanation :
Since in the question it is clearly stated that only when the power is ON the whole process will begin. This is followed by the availability of the water supply. if either of these two conditions is not satisfied washing machine process will not begin.
Therefore the only positive condition is connected to the process while the negative condition is connected to the separate Junction. As per the question the first process soaking is carried for 200 seconds which is represented as after(200,sec), the heading for this block can be assigned as per the block requirement. I have given the entry value zero and the exit value as one. The same process is carried in the dryer process then finally the end block with an entry value of T.
Simulink Model :

Constant lock has been connected to the state flowchart as input. These two constant blocks are in turn controlled by a slider switch. Five outputs are collected from the state flow chart to the display. This five outputs indicate the four different processes that are happening inside the washing machine (soaking, washing, rinsing and dryer) and the last one is the finish. Both the inputs and outputs are connected to a lamp which is defined in a way that it makes green light when the output is one and a emits red light when the output zero.
RESULTS :
CASE 1 - in case one I switch on the slider switch for the power but as per the question if the water supply is not done ON the whole process cannot begin hence in the below shows similar block except the power button rest all is in red colour
CASE 2 - in second case I have turned ON both the power & the water supply. the simulation is made to run for 250 seconds. The result indicates that the washing process has started with the soaking process been completed. As in the question the soaking process is done for 200 seconds. Similarly based on the time and location the simulation is made to run to achieve the rest of the process.

CASE 3 -
This is the final result indicating that all the processes with the washing machine have been carried out under the given initial conditions.

OBJECTIVE 2 - Simulink chart for Gear shift Logic.
The gear shifting mechanism is kept inside the transmission to provide a uniform torque towards the drive shaft. This is because the IC engine produces the optimum torque any after a optimum speed & it drops again.
So in order to achieve the optimum torque on a continuous basis transmission is used with this can manipulate the torque with the help of gear ratio.
Manual transmission Gear :
As shown in the figure below manual transmission hey synchronous gears,On continuously meshed gears are kept.
Based on the speed requirement the gear is shifted using the gear knob, which in turn makes the collar gear to get meshed with the appropriate gears. The output shaft is connected to the collar gear hence whichever gear gets mixed with the collar gear will be the output shaft. During the gear shifting process it is mandatory that the input shaft is disengaged from the engine. This is done with the help of clutch plate.

State flow chart case 2-

here as per the question the gears are arranged with the condition of the speed range. For example speed above 0 till 1 Will fall under first gear and the chart is also designated in such a way to satisfy the condition.
simulink model case 1

In this case 2 input blocks okay when is the constant and the other is the slider gain block The slider gain block perform a scaler gain that you can modify during the simulation. The block supports fixed point data types. The value given in the constant Block gets multiplied the slider gain value during the simulation.
To determine the gear value required for the particular speed display Block is also pleased the lamp is also pleased whose perimeter is a set in a way that for each get it will produce individual colours the colour inputs are shown below
Results : CASE 2-
(1) For the first gear speed is 10(KMPH)

(2) For the second gear speed is 20(KMPH)

(3) For the 3rd gear speed is 30KMPH

(4) For the 4th gear speed is 50KMPH

(5) For the 5th gear speed is 70Kmph

CONCLUSIONS :
We have implemented control logic of a “washing machine” using Stateflow in simulink.
We made a Simulink chart for the “Gear shift” logic as per given initial conditions