Challenge

Week - 4

QUESTION 1 :

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.

SIMULINK MODEL :

EXPLANATION :

1) First chart has been created using 'CHART BLOCK' to define the logic of washing machine.

2) The first state is 'power state' where the program checks whether the power is ON/OFF. If the power is ON it will go to the next state or else it will stop. I have defined the variable 'P' which will help us to indiacte the state is going or not.

3) The second state is 'Water state' where water will be filled similarly i have defined the variable 'W' to check whether the water is being filled on not. The process between Power and Water state is defined as if power is On then the water flow will start, if the power is OFF and its zero means then it will remain only in power state.

4) The third state is 'soak state' this is where the clothes are entered once the water is filled. Here the variable defined is 'S' when the value is 1 then the state is going on. Once the process is over it exits by a value S=0 which means the state is going on.

5) The 'wash soak' is initiated were the clothes are washed as per the conditions mentioned above after 200s of soaking the washing takes place. The condition is mentioned between the 'wash state' and 'soak state'.

6) Then 'Rinse state' takes place after all the water is drained out, The state will indicate 'R=1' once the state is over it will indiacte 'R=0' and the next state will take place.

7) Next state is 'Dry state' where the clothes are dried inside the machine. This state will indicate 'D=1' once the state is over then 'D=0' and the next state will take place.

8) The final state is 'finish state' this is the final step and the power need to be manually swicted off.

STATEFLOW :

9) Once the machine logic is created we have defined the variables entered as output variables and power and water as inputs as these have to be provided to the machine.

10) To give power and water as input we have used a 'slider switch block' and 'constant block' is used. each slider switch is connected to each constant block when the switch is ON the value of constant block '1' and this constant block is connected to the chart block where the washing machine program is defined.

11) If the slider switch is off the value in constant block is '0' which is indicating that there will be no power or water supply. For outputs it all have been connected with the display block each.

SYMBOLS PLANE :

12) These display blocks are connected to the 'lamp block' which will turn green when the particular state is going and if the particular state is not going on then the lamp will become red.

13) The conditions of the lamp block is set.

14) When the process is in run the lamps will give red and green colors when the particular state is going on, thus showing the process of washing machine.

QUESTION 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.

SIMULINK MODEL :

EXPLANATION :

1) The 'chart block' is used to define the gear shift logic.

2) Gears have been defined as 5 states namely 'Gear 1','Gear 2','Gear 3','Gear 4' and 'Gear 5'.

3) Now to shift from one state to another conditions have been defined with respect to the speeds.

4) We have also defined values inside the states which represent that when the particular state is going on it will display the value is defined in it. This will help to identify the gear of the vehicle in that particular speed.

5) WE have defined the speed as input of the chart as the gears change only on basis of speed and variable 'G' is defined output of the chart which gear the vehicle is in.

6) Now the signal builder is used to give input to the chart and the different speeds have been given in the 'signal builder block'.

SIGNAL BUILDER BLOCK :

7) According to the speed the gears in the chart will change , to indicate the change in gears 'Lamp block' is used. The values of the lamp block is set so that when the gear is changed that particular gear lamp will glow as green color.

8) Now the output of the chart is connected to the 'scope block' which will give graphical representation of each gear at different speeds and the signal builder block is also connected to the scope block so that we can compare speed and gears at same time.

SCOPE BLOCK :

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.