Week - 4
TASK 1
AIM: To implement control logic of a “washing machine” using Stateflow as per given sequence
OBJECTIVE:
- 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
THEORY:
WASHING MACHINE:
A washing machine (laundry machine, clothes washer, or washer) 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.

Block diagram:
The pictorial representation of a block diagram of washing machine is

Conditions are
- When the lamp shows Green, task is in progress.
- When the lamp shows Red, task ends.
- In the constant box, when the value is '1' there is input. If the value is '0',there is no input.
- We are connected a slider switch to ON & OFF the water supply and power supply.
- We connected a lamp to every output to indicate the sign.
Chart diagram:

- We have created a chart by using 'chart block' to define logic.
- Firstly we created a 'power block' whether the power is ON or OFF. If it is ON it will go to next stage otherwise it will not go to further stage.
- Similarly we created a Water, Soaking, Washing, Rinsing, Dryer and End states.
- We have given the entry value and exit value for each state. '1' represents state is going on, Once the state is completed it exits by a value '0'.
- This process is similar to all states.
- As the conditions mentioned above the time is given to each state.
Parameters:
We have to give input as well as output by using symbol pane

- Here we have given water_in and power_in as inputs
- Here we have given Water, soak(s), Wash(w), Rinse(r), Dry(d), End(e) as outputs.
OUTPUT:
We have two conditions to solve this problem
- When the water supply is OFF
We should not supply water input and run the program, we got the output as

We used 430 sec so that it can cover the whole cycle and sufficient time to store and solve the parameters.
From the above diagram, We can see that indicator of water is showing Red i.e., When there is no water supply the process is terminated and LED indicator is used to indicate that state.
- When the water supply is ON
Here we are providing water supply and check the output.

We used 430 sec so that it can cover the whole cycle and sufficient time to store and solve the parameters.
As we can observe from teh above figure, All the states have been executed and indicating the Process completion indicator (named as cycle) showing Green.
CONCLUSION:
The simulation of the Washing machine using State flow is done and the result is satisfactory.
TASK 2
AIM: To make a Simulink chart for the Gear shift logic.
OBJECTIVE: Making a simulink chart for the Gear Shift for the below mentioned conditions:
Speed Range(kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5
THEORY:
CAR GEAR SHIFTS:
A manual transmission (also known as a manual gearbox; abbreviated as MT) is a multi-speed transmission where gear changes require the driver to select the gears by manually operating a gear stick and clutch (which is usually a foot pedal for cars, or a hand lever for motorcycles).
Early automobiles used sliding mesh manual transmissions with up to three forward gear ratios. Since the 1950s, constant mesh manual transmissions have become increasingly commonplace and the number of forward ratios has increased to 5-speed and 6-speed manual transmissions for current vehicles.
The alternative to a manual transmission is the automatic transmissions; common types of automatic transmissions are the hydraulic automatic transmission (AT), automated manual transmission (AMT), dual-clutch transmission (DCT), and the continuously variable transmission (CVT).
BLOCK DIAGRAM:

- We are created a 'slider gain' block to display the gear number while simulation is running
- We connected display block to chart to display the results.
Chart Diagram:

- First, we have defined fives states namely ‘Gear1’, ‘Gear2’, ‘Gear3’, ‘Gear4’, ‘Gear5’.
- Now to shift from one state to another we have defined the conditions of the speeds as mentioned above.
Parameters:
We have to give input as well as output by using symbol pane

- Here we gave speed as input and gear as output.
Input:
We use slider gain to provide input to the chart.

I am changing my speed values from 0 to 100 using slider gain during the simulation.
OUTPUT:
The Output produced is recorded when it's displaying the each gear.
Gear-1:
Speed range: 0 to 15kmph.
Input speed: 10kmph.

Gear-2:
Speed range: 16 to 25kmph.
Input speed: 20kmph.

Gear-3:
Speed range: 26 to 40kmph.
Input speed: 30kmph.

Gear-4:
Speed range: 41 to 60kmph.
Input speed: 50kmph.

Gear-5:
Speed range: above 60kmph.
Input speed: 70kmph.

CONCLUSION:
Created a State Flow for Gear Shift using Simulink and the results are satisfactory.