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

Ans:-

Implementation of control logic chart for washing machine using stateflow process

1.start simulink and create a blank model

2.search for chart block in the stateflow category of library browser

3.Open the chart block and select the junction feature form the stateflow window

4.Control logic for washing M/c is such that it should soak the water for the first 200 sec followed by washing time of 100 sec .Rinsing the water for The next 20 sec followed by drying time of 50 SEC.

5.After finishing the control logic run the stateflow and check the sequence of operation of 370 sec.

Blocks used.

1.Chart

a Finite state machine is a representation of an event-driver system.in an event driver 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

2.Display

the display block show the value of the input data.you can specify the frequency of the display .for numeric input data,you can also specify the format of the display.

3.Constant

the contstant block generated a real or complex constant value signal.use this block to provide a constant signal input

4.Lamp

the lamp block displays a color 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 indicators for your model.you can specify pairs of input values and colors to provide the information you want during the simulation

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 rocket switch block to a switch block in your model and change its state during simulation

Logic explanation

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

Washing machine logic

In the above control logic first state is created with 2 conditions for power supply.

one is with power supply avialable (Power switch==1) and second with water supply available

(W==1) .if the power supply at entry is 1 and water supply is on ,then machine will get activated and start the next process of operation

Next 4 Operation states have been created in flow order

soaking,washing,rinsing,drying with their time of operation as 200sec for a soak ,100sec for wash ,20 secs for rinse & 50 sec for dry .entry and exit condition of the state are kept as 0 & I.e at entry of operation states it is 0 and as operation completes it is 1 for every states.

after all process has done washing machine Completed LED will glow and we can shut the machine off.

Symbols pane

Here ,

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

Completed simulink model,showing that 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 completed & rinsing is going on

Here red light means operations which are not completed and green light shows operation which are completed.

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

The blocks used are same the above functions except we are going to use slider in extra

*Slider

The slider block tunes the value of the connected block parameter during the simulation .for example, you can connect the slider block to gain block in model and adjust its value during the simulation.you can modify the range of the slider blocks scale to fit your date.

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 & 5 respectively and their transitiion is connected with speed range condition as shown

3.The transition condition for the gear shift is decided 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 froom 0-60 kmph

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 60-0 kmph

while simulation gear_shift_logic,Engine[E==1] Condition given with varioius speed change values

Here,

'E'(engine on/off) and 'speed' as input given while all other like power switch ,gear_first,gear_second,gear_third,gear_fourth,gear_fifth are all as output given.

Simulink model at different speeds.

at speed =72 Kmph

at speed 72 kmph which is above 61 kmph gear 5 is implemented and gear_fifth LED is glow green and display output as 1

at speed=20kmph

at speed 20 kmph which is above 16 kmph gear 2 is implemented and gear_second LED is glow green and display output as 1

at speed =48kmph

At speed 48 kmph which is above 40kmph gear 4 is implemented and gear_fourth LED is glow green and display output as 1

and thus all condition simulated through stateflow chart successfully

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.