Week - 4
AIM :
1. TO Implement control logic of a “washing machine” using Stateflow as per given sequence
2. make a simulink chart for the 'GEAR SHIFT' logic as per given condituions
OBJECTIVES :
1. in simulink , implement the control logic of a washing machine.. using state flow as per given conditions..create a model and operate the model logic system and display the output of the results by using lamp indicator.
2.Create a model for gear shifting logic as per given conditions.
give the speed input while simulation is running and display the gear number
Control Logic:
Control Logic is model system logic using State machines, Flowchart and Truth Tables.
Explanation of Control Logic of a Washing Machine using State Flow:
State Flow is a Simulink tool to implement the state machine. Here, the model system logic of a Washing Machine using State Flow has been done.
Step 1: Create a chart and enter the given input conditions.
Given Input Conditions:
- 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 completion of the process.. turn on the LED
STEP 2:
After entering the input coditions in the chart, the go to simbol spane asssign the given variable.(example : input data, output data and etc , etc...

STEP3 : Give the input values for turning ON or OFF for the power supply and water supply.
CONDITION:
if value = 1,power and water supply will turn ON.
if value =0, power aand water supply will turn OFF.
STEP 4 : USE display block and 'lamp' indicater to display the result..
WASHING MACHINE

...........................................................................................................................................................................
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:
TO make the simulink chart for the gear shift logic as per the ggiven conditions .. i have the mentioned the blocks blocks which i have used
- Chart block
- Constant block
- slider block
- display blocks for 5 Gears



The Gear is given as input data.
G1, G2, G3, G4 and G5 are given as output data.
1. I have used the Slider block to give the input (speed) to Constant block, here the slider speed is varies, by changing the slider position manully to put the required input.
2. With the help of Constant block the slider block input values are given to the Chart.
3. The State blocks are used inside the chart to implement the conditioned state flow
4. First, the input values are given to the GEAR SHIFT state, according to the condition, 'Gear>0', it proceeds to the
next state or else 'Gear==0' it ends process (it doesn't change shift's to the next gear). 5. If 'Gear >0' it moves to the GEARI and when the input value crosses 15kmph, it moves to the next state (GEAR2)
otherwise it will remains at GEAR1 state.
6. If the 'Gear>15' it moves to GEAR2 and it will remains at GEAR2 till the speed is less than 25kmph, if the speed
exceeds 25kmph it moves to GEAR3.
7. If the speed lies between 25kmph to 40kmph the gear will be at GEAR3 state, once the speed exceed 40kmph it will moves to GEART4.
8. If the speed lies between 40kmph to 60kmph the gear will be at GEAR4, if the speed exceeds 60kmph it moves to GEAR5.
9. The Display blocks are connected to the chart outputs (G1, G2, G3, G4 and G5) to show the gear position, if the display block of G1 shows 1 means the gear is at GEARI position and the remaining display blocks shows 0. In same manner each display block shows 1 for respective gear position.