Week - 4
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.
>>
Block Diagram of the Washing Machine:

Stateflow:
Explanation:
Equipment Required:
Slider Swtich,stateflow (Chart), Display,lamp.
- First we have to create a stateflow chart of washing Machine which include power supply, water, soaking time, washing time, rinsing, dry and end of the cycle.
- To start the Chart we need a breakpoint added with the chart Power.
Note: We can name the chart with any name to define the chart as per our preference.
3.As we can view the Stateflow Diagram fig, from power to water we need to make a loop with conditions if power is one the flow of current goes to engage to water and when the water has 1 condition the washing machine cycle runs from soak till the end. We can the see te junction used to connect water and power that is if-else loop.
4.we have given soak time entry A=0 and exit A=1 with this we set breakpoint flow of the water is for 200 sec and once it reaches above 200 sec it will go to the next process(washing). For every mode the condition is set as we can view in the stateflow diagram.
5.Once we done creating the charts we have to check the input and output through the symbols tool which is on the top most left side of the chart page. Click on symbol Pane and we have to define the input and output.

6. Now we have to connect the power and water to constant and all the five outputs to display.
7.Connect the swtich and lamp to input of power and water.
RESULT:
Power and water supply OFF:

Power ON and water OFF:

Power OFF and water ON:

Power ON and Water Supply ON: Water filling Process
Power ON and Water supply on only soaking process:

Power ON water supply on only soaking and washing process:

Power ON water supply on only soaking and washing process and rinsing:

Power ON and water ON, All process are happening:

CONCLUSION:
We have successfully achieved Stateflow chart of the washing Machine and all its condition.
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 of Gear:

Stateflow Chart:
Explanation:
Equipment required: Slider Switch, constant, Display, Stateflow(Chart), Lamp, Slider block, Custom Gauge.
- First we have to create a stateflow chart with two inputs speed and engine. The speed input is connected to constant (Accelerator) and engine input is connected to another constant (Ignition On/OFF). This constant (Ignition On/OFF).
Initially we have to assgin the parameters for the slider as we can view in the below fig.
2. In Stateflow chart, checking ignition condition, we take "engine" as input Giving the condition as "engine=0" this will execute when the constant value is 0 that is when the vehicle is turned off and another condition as "engine=1" this will execute when the constant value is 1 that is when the vehicle is turned ON.
- After the ignition condition is turned on the state flows to the next processes. Speed conditions are defined for each block. When it exceeds the speed condition the process flows to the next block. All the conditions have been assigned to each block.
- The Stateflow chart has two outputs named "A" and "B", these outputs are connected to the display blocks. The display block connected with the output "A" is named "Gear Indicator" and the display block connected with the output "B" is named "Overspeed ".
- The "Gear Indicator" display block displays the exact gear at which the vehicle is running. Five lamps have been connected to this display block in order to turn on the lamp for each gear ratio, that is done by assigning different state value for each lamp
- The "Overspeed " display block displays the condition when the vehicle is attaining Overspeed situation.
- we have given different colours for every speed limit (gear colour)






>>We have successfully achieved stateflow chart of the Gear shift and all its condition.