Week - 4
Aim:
- To implement control logic of a ‘’washing machine’’ using stateflow.
- To make a Simulink chart for the ‘’gear shift’’ logic as per given condition.
Objectives:
- Given condition for ‘’washing machine’’
- 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 tome of 100s
- Then rinsing happens for next 20s & dryer runs for 50s
- Given condition for ‘’Gear shift’’
Speed range (kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5
Explanation:
Stateflow
Stateflow provides a graphical language that includes state transition diagrams, flow charts, state transition tables, and truth tables. By using stateflow to describe how matlab algorithms and Simulink models react to input signals, events, and time-based conditions.
Control logic
Control logic is model system logic using state machines, flowchart and truth tables.
1.washing machine
Control logic of washing machine and explanation
- To crete this control system in Simulink insert the chart and create the logic system using stateflow. The stateflow excute the flow of inputs if the condition is accept.
- In this control logic the input power is applied to ON the washing machine is power supply and water supply.
- Water supply is execute when the power is ON, so entry and exit are assigned as value of 0 to 1. While the condition is not ok water supply stops and it will come back to its constant state.
- This process is applied for each flow and time of working in each operation are initiate by seconds that are given in question.
- Now assigned the input values of steady flow and sequence of operation is initiate to identify the working division. Constant block is created to give an input value of system.
- Lamp block is inserted to indicates whether the operations are ON or OFF in different states.

Simulink model is created and inputs are generated to power supply and water supply:
- If the power supply and water supply are assigned as 0 value the output value of all operations become zero because no inputs are generated and conditions are not applied.

- In this power supply is assigned as value 1 and water supply remains 0. The power are generated and that indicates as in display values 1 lamp is green light. But the water supply is 0 so other operations are not proceed that value as 0 and lamp is in red light.

- Here the power supply and water supply valued are assigned as 1. Power are generated from input and the operation starts, water supply also done by initiate the value of 1.
- Sequence of operation in state flow starts when the condition is getting satisfied. Water supply is generated and other operations are followed by duration of time that we given in state flow.
- each results are obtained by display block. Lamp is turned ON and it indicates green color as result.

Question 2
Gear shift:
Given condition:
Speed range(kmph) gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5
- in this model inputs are generated to slider gain which is connected to constant block the value is 1. The gear shift is acted by conditions in staeflow.
- Chart is created and conditions are applied same as washing machine stateflow.
- The gear is shifted by variations in speed . an speed range are cratd in chart as several gear system and conditions are applied.
- Display block is used to obtain the result. That displays which gear is running in particular range off speed .

Gear neutral
When speed range is 0 the gear is in neutral and output value of display remains 0.

Gear 1
When speed range is 0 to 15 the gear 1 is proceed and output value of display gives 1.

Gear2
When speed range is 16 to 25 the gear 3 is proceed and the output value gives 3

Gear 3
When speed range is 26 to 40 the gear 3 is proceed and output value of display gives 3

Gear 4
When speed range is 41 to 60 the gear 4 is proceed and the output value of display gives 4.

Gear 5
When speed range is above 61 the gear 5 is proceed and output value of dispolay gives 5
