Week - 4
Implement control logic of a “washing machine” using Stateflow as per given sequence:
The design has implemented as shown below

As per the requirement the power supply is given as input via a toggle switch linked to a constant whose value changes from ON to OFF.
0(OFF) condition is being highlighted using lamp, RED colour. During this condition the whole system will not depend on any other value and system will be in shutdown condition.

1(ON) condition is being highlighted using lamp, GREEN colour for ON condition. During this condition the whole system will depend on value of water supply for further operation.
If water supply is being cut down or unavailable, the system will be again in shutdown condition else it will be in working. This condition is simulated again by the use of toggle switch connected to a constant value.
So, if with power supply in state 1, water supply being in OFF state, 0 state, our system won’t function.

On the other side if both power supply and water is available the system will function according to design, which is
Soaking for 200 sec, so after soaking for 200 sec, so the indicator for completion of soaking will be turned to GREEN from RED.

The next stage of washing, needs 100 sec for completion, so the indicator for completion of washing will be turned to GREEN from RED.

The next stage of rinsing, needs 20 sec for completion, so the indicator for completion of rinsing will be turned to GREEN from RED.

The next stage of drying, needs 50 sec for completion, so the indicator for completion of drying along with end of process will be turned to GREEN from RED.

The stateflow for the implemented system is shown below

Simulink chart for the “Gear shift”
The system is implemented starting from ignition on or off condition. If the ignition is on the gear shift mechanism will work, else it won’t.
As per the requirement depending upon the speed criteria the shift in gear is made. In accordance to the need the state flow has been designed, which is shown as below.

So the change in speed is implemented using a gain slider and the change of value is displayed using a circular gauge from dashboard. This gain slider is having an input as constant with value = 1. So as the slider is changed the value of speed is also varied and depending upon the value of speed the value of gear is displayed on to the display, which is the output of state flow model.
The implemented system is as shown below.

So with variable speed , we can see the change in circular guage , gear value and on/off condition from display
When speed in is between 0 to 15

As it’s visible that slider value is at 12, so from gauge, the speed display is 12. Gear value is 1 and it’s in ON condition. Also, its visible from the chart, that the state has moved to 2nd condition highlighted with blue border.
When speed in is between 16 to 25

As it’s visible that slider value is at 21, so from gauge, the speed display is 21. Gear value is 2 and it’s in ON condition. Also, its visible from the chart, that the state has moved to 3rd condition highlighted with blue border.
When speed in is between 26 to 40

As it’s visible that slider value is at 39, so from gauge, the speed display is 39. Gear value is 3 and it’s in ON condition. Also, its visible from the chart, that the state has moved to 4th condition highlighted with blue border.
When speed in is between 40 to 60

As it’s visible that slider value is at 57, so from gauge, the speed display is 57. Gear value is 4 and it’s in ON condition. Also, its visible from the chart, that the state has moved to 5th condition highlighted with blue border.
When speed is above 60

As it’s visible that slider value is at 39, so from gauge, the speed display is 39. Gear value is 5 and it’s in ON condition. Also, its visible from the chart, that the state has moved to 6th condition highlighted with blue border.