Week - 4
Question 1:
Objective: 1) Implementation of Control Logic of a "Washing Machine" using Stateflow that consists of processes with certain time delay.
2) Observation of the system behaviour at both with or without Water Supply thorugh indication given by LED and also analyzing the system pertaining to different processes.
Simulink Model:

The above model consists of "LAMP" form Dashboard representing LED pertaining to each processes and also as a water supply indication. The basic intention of this is to check the state of the Lamp i.e whether it is On or Off at different Stop Time interval along with the change in the water supply input. The corresponding state flow of the above logic is shown below:

So here in this stateflow initially we check whether the Power supply and Water Supply is available to us or not and after the confirmation we proceed with the Four processes of Soaking, Washing, Rinsing and Dryer happening at a certain time interval and after the entire cycle is over we end the process with an indiaction from a LED.
So here we have taken Power and water as input and rest are output as shown below:

Model Explanation:
WHEN THE WATER SUPPLY IS NOT AVAILABLE:
In this scenario as there is no water entering into the system so the controller of the washing machine will not be able to proceed further and instantly all the LAMP will get turned off except the Power supply as shown below:

WHEN THE WATER SUPPLY IS AVAILABLE AND THE MODEL IS RUN FOR FIRST 200SEC:
In this scenario as the water is entering into the system, so the controller will activate the processes to happen but as the Stop Time is given for 200sec so only Soaking Process will take place due to the reason that the time delay of Soaking is given for 200 sec(as per question). This entire process will get indicated by LED as shown below:

WATER SUPPLY IS AVAILABLE AND THE MODEL IS RUN FOR 300SEC:
In this scenario, the time interval for Soaking process gets over and washing process get started which is why the LED pertaining to Soaking gets OFF and Washing gets ON as per the below figure:

WHEN THE MODEL IS RUN FOR 320SEC:
In this scenario, the time interval for Washing Process gets over and its move onto the next process which is Rinsing that can be seen clearly from the LED switching as given below:

WHEN THE MODEL IS RUN FOR 350SEC:
In this scenario, the time interval for Rinsing Process gets over and its move onto the next process which is Dryer that can be seen clearly from the LED switching and as no water is required in this process so it will be cut off as per the figure given below:

WHEN THE MODEL IS RUN FOR 400SEC:
In this scenario, all the processes gets over which gets indicated by the turning ON of the LED thereby finishing the cycle as shown below:
Therefore this concludes the cycle and the controller will moves back to its initial position from where it can starts another cycle.
Question 2:
Objective: Implementation of a Gear Logic which leads to the display of the Gear number(as per criteria) by varying the Speed as an input.
Simulink Model:

As per the criteria of the speed given in the question there are 5 Gear ranges, whenever the speed falls in a particular range the corresponding Gear gets activated which can be visible from the turning ON of the LED. Here in this model the Stop Time is taken as infinite and with the help of Slider Gain we will change the value of the Speed while the Simulation is running and therefore can able to see the shifting of the Gear Value along with the LED. The corresponding stateflow of the above model is shown below:

The criteria of changing the state is entirely depends on the value of Speed. So, here the Speed is taken as an input whereas the Gear is taken as an output as shown below:

Model Explanation:
So as we will change the value of speed while the Simulation is running, the corresponding value of the gear will get change as per the range which can be clearly seen form the figures below:

Now the input Speed changes further...

Now the Speed changes to 30..

Now the input speed changes to 45..

Now finally the Speed changes to 70...

In this way accordingly the value of the Gear will get change corresponding to the range of the Speed defined in the Stateflow diagram. So again if we starts decreasing the value of the Speed then value of the Gear also starts to deacrease in a cumulative fashion.