Week - 4
Ans. to question no.-1: Here I attached my simulink file as washingmachineproblem.slx where I have used stateflow for carrying out the problem. I have assigned "powersupply" and "watersupply" as input variables and the rest "water, wash, soak, rinse, power, dry and End" as output variables. To give input to "powersupply" and "watersupply" we have used two sliderswitch. Now the program will execute as per desired in the question:-
a) First "powersupply" input will be checked. If there's powersupply then the program will carry forward to next step else it will "End" up.
b) After powersupply is available, it will check for "watersupply". If watersupply is available then it will proceed further else the program will "End".
c) After watersupply availability is checked then the program will continue to next steps like:- soak, wash,rinse and dry respectively at the desired time intervals.
d) Finally after "dry" the program will "End".
Answer to question no.-2: Here I have attached my simulink file as gearshift.slx for gearshift challenge. In this stateflow logic I have used "speed" as the input variable and "gear" as the output variable. I have linked display for showing what is the gear state for each change in speed. Moreover, to give the "speed" input I have used a "slider" which is linked to the "speed" variable. Now the program will execute as desired in the question.
For every change in speed using the "slider" we get the respective "gear" state output