Challenge

Week - 4

Simulink Blocks and Control Logic Stateflow For 'Washing Machine' and 'Gear Shift'.

  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.

Study 1:-

Implementation of control logic chart for 'Washing Machine' using stateflow.

Process:-

1. Start Simulink and create blank model.

2. search chart block in the state flow cateogory of library browser.

3. control logic for washing machine such that it should soak the water for the first 200sec. followed by washing time of 100sec. rinsing the water for the next. 20 sec. followed by drying time of 50 sec.

4. after finishing the control logic run the stateflow and check the sequence of operation for 370 sec.

Which Block used in the this control logic:-

1. Display

Display block shows the value of output data. you can specify the frequency of the display.

2. Constant

The constant blocks genrate a real or complex constant value signal. used this block to provide constant signal input.

3. Chart

A finite state machine is a representation of an event driven reactive system. in an event driven reactive system, the system responds to an event by making a transition.

from one state to another. this transition occurs if the condition defining the change is true.

4. Lamp

The lamp block display a colour indicating the value of the input signal. you can use the Lamp Block with other dashboard blocks to build an interactive. dashboard of controls and for your model.

5. Rocker Switch:-

The Rocker Switch Block Toggles the value of the connected block parameter between two values during simulation. for example ,you can connect the rocker switch block to a switch block in your model and change its state during simulation.

Logical Explnation:-

A Rocker Switch from the dashboard library is used with a constant to supply the power and as water supply. a lamp is used to indicate the power status and water status. the power status is checked at the entry for every. state and the water supply is checked for soaking and the rinsing process. the timining for each state is as per the given inputs.the status of the running process can be seen by glowing lamp coreesponding to the process name.

Washing Machine Logic:-

In the above control logic first state is created with two condition for power supply.

one is with power supply available (power switch==1) and second with water supply available (w==1).

if the power supply at entry is one and water supply is on , then machine will get activated and start the next process of operation.

Next 4 operation state have been created in flow order soaking, washing , rinsing, drying with there time of opertion as 200 sec. for a soak, 100 sec. for wash ,20 sec. rins, 50 sec. for dry.entry and exit condition of the state are kept as 0 & ie. at entry operation state it is 0 an as operation completes it is one for every states.

After all process has done washing machine completed LED will glow and we can shut the machine OFF.

Symbols Plane :-

Here,

Powe supply and water supply is an input and while all other washing_state,D(dryer),Wa(washing),S(soaking) , R(rinsing),washing_completed are all output given.

Complete Simulink Model , showing that the washing process is completed.

Here all LED glown as green means all process has been completed and all display output as 1.

Simulink Model , Showing that the washing process is copmleted and Rinsing is going on.

Here pink light means operation is not completed and Green LED shows operation is completed which is also check from display box as a output 1.

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

Implementation of control logic chart for 'Gear Shift' using stateflow.

Process:-

1. Start Simulink and create blank model.

2. search chart block in the state flow cateogory of library browser.

3. Control logic for gear shift is such that it should change the gear when the soeed increases of decreases automatically.

4. After finishing the contrl logic run the stateflow and check the gear shift operation for an infinite time.

Which Block used in the this control logic:-

1. Display

Display block shows the value of output data. you can specify the frequency of the display.

2. Constant

The constant blocks genrate a real or complex constant value signal. used this block to provide constant signal input.

3. Chart

A finite state machine is a representation of an event driven reactive system. in an event driven reactive system, the system responds to an event by making a transition.

from one state to another. this transition occurs if the condition defining the change is true.

4. Lamp

The lamp block display a colour indicating the value of the input signal. you can use the Lamp Block with other dashboard blocks to build an interactive. dashboard of controls and for your model.

5. Rocker Switch:-

The Rocker Switch Block Toggles the value of the connected block parameter between two values during simulation. for example ,you can connect the rocker switch block to a switch block in your model and change its state during simulation.

6. Slider

The slider block tunes the value of the connected block parameter during the simulation. for exampple , you can connect slider block to a gaon block in your model. blocks to create an interactive dashboard to cintrol your model.

Logic Explanation:-

The speed Ranges from 0 to 100 and the slider is used to send the input. The 1st gear has speed values from 0 to 15 so the entry condition for the 1st gear is 0<=speed and speed <=15 and the exit condition is when the speed greater than 15.

Similarly, ffor 2nd gear , the entry condition is 16<=speed and speed<=25 the exit condition is when tspeed<16 and speed>25. in the same way for each gear the entry and the exit condition are specified and the out is mapped to the lamp and display block.

Gear shifting Logic:-

1. In the above control logic , First engine is started from input switch E=0/1 through rocker switch which is power switch to make engine ON. then next Gear_Shift_Logic implemented through following states.

2. Five Gear state is created with state condition of gear (G) 1,2,3,4 and 5 respectively and their trasition is connected with speed rangecondition as shown.

3.The transition condition for the gear shift is decides as

Speed>15 shift to G=2

Speed>25 shift to G=3

Speed>40 shift to G=4

Speed>60 shift to G=5 when the speed is increasing from 0-60kmph.

similarly in reverse direction

Speed<60 shift to G=4

Speed<40 shift to G=3

Speed<25 shift to G=2

Speed<15 shift to G=1 when the speed is decreasing from 0-60kmph.

while simulating Gear_shift_logic,Engine[E==1] condition given with various speed change values.

SYMBOL PLANE:-

Here,

'E' (Engine on/off) and 'Speed' as input given while all other like PowerSwitch ,Gear_1,Gear_2,Gear_3,Gear_4,Gear_5 are all as output given.

SIMULINK MODEL AT DIFFERENT SPEEDS:-

At speed = 23

at speed 23 kmph which is above 16 kmph gear_2 is implemented and gear_2 LED is glown and display output as 1.

At Speed=45

at speed 45 kmph which is above 40 kmph gear_4 is implemented and gear_4 LED is glown and display output as 1.

At Speed=80

at speed 80 kmph which is above 61 kmph gear_5 is implemented and gear_5 LED is glown and display output as 1.

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.