Challenge

Week - 4

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

Ans.:

Following model shows the control logic of a " washing machine" using stateflow:

To Creat automatic washing machine logic I used chart function block from simulink &logic as shown below:-

Process:

1) I created a chart block and inside chart block I made state flow logic for washing machine by using states.

2) Then input and output of chart block added from simulink blocks.For input have been added two constants . one is for Power supply (input1) and another is for water supply( input2).

3) For output I have used Display for each condition ,here we can use scope also for output.

4) Lamp is also added which gives signal(will glow) for particular condition.

5) And get the result by hit the run.

Block used with Function:

1) Chart: It is an event driven system ,that respond to an event by making a transition from one state to another state.In this chart we can creat the stateflow logic.

2) Constant: The constant block generate the real or complex value signal.

3) Lamp: For indication purpose only.

4) Display: To get result either 1 or 0( ON/OFF).

For all conditions like soaking,washing,rinsing etc.of lamp have given different colours shown below:

Power On - RED

WATER - GREEN

SOAKING - BROWN

WASHING - BLUE

RINSING - PURPLE

DRYING - YELLOW

FINISH - PINK

When we get supply to the model the power ON lamp will indicate RED as shown below.:

Now if water is Not available then will see GREEN colour lamp will glow i.e. "water not available" lamp and display indicate 1.

Now,if water available then process will continue ,after input2 is 1 then soaking lamp will glow(BROWN) (soaking time =200sec.)

Then after 200 sec. washing will be done and washing lamp (BLUE) will glow and display shows 1.( washing time= 100 sec.)

after 100 sec. rinsing will done ad rinsing lamp(PURPLE) will glow display shows 1(rinsing time = 20 sec.)

Then next drying will done and drying lamp(YELLOW) will glow display shows 1(drying time=50 sec.)

and last after 50 sec. finished process and finish lamp (PINK) will glow.

2. Make a simulink chart for the " Gear shift" logic as per beow condition:

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.

Ans.:

Following model shows the GEAR shift:

Created the logic as per given condition in chart block as shown below.

Following blocks are used in the model:

1) Chart : In this Chart we can creat the stateflow logic.It is an event driven system ,the system respond to an event by making a transition from one state to another state.

2) Constant: The constant block generates the real or complex value signal.

3) Lamp: For indication purpose only.

4) Display: To get the result either 1 or 0 (ON/OFF).

5) Slider Gain: To vary the speed.

Now if the speed in between 0-15kmph then gear 1 will on and gear1 lamp will glow.

When speed increases in between 16-25kmph gear 2 will on and gear2 lamp will glow.

After if speed increases in between 26-40kmph gear3 will on and gear3 lamp will glow.

If speed in between 41-60kmph gear4 will on and glow gear4 lamp.

Finally if speed above 61kmph then gear will shift to last 5th gear and gear5 lamp will glow.

Following are the link of Result:

Question 1. Washing machine

https://drive.google.com/file/d/1UlOQM1WzP_IlOgl7qH5eYdv6Kjazg8yn/view?usp=sharing

Question 2. Gear shift

https://drive.google.com/file/d/1P4vwktR895riSXWpiEHXZ2n6QQVShT7L/view?usp=sharing

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.