Challenge

Week - 4

I.Implementation of control logic chart for washing machine using stateflow

process:

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 from the stateflow window.

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

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

Blocks Used

1.chart

A finite state machine is a reprentation of an event-driven(reactive) system.in an event-driven system,the system responds to an event by making a transition from one state(mode) to another.This transition occurs if the condition defining the change is true.

2.Display

The Display block shows the value of the input data. You can specify the frequecy of the display. For numeric input data, you can also specify the format of the display.

3.Constant

The constant block generates 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 value and colors to provide the information you want during the simulation.

5.Rocker switch

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

Logic Explanation

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 is checked at the entry for evevry state and the water supply is checked for the soking 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 corre4sponding 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 available(powerswitch==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,20sec for Rinse & 50sec 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 completets it is 1 for every states. After all process has done washing machine completetd LED will glow and we can shut the machine off.

SYMBOLS PANE:

Here,

Powerswitch & w(water supply) is as input given while all other like washing_state, D(dryer),wa(washing),s(soaking),R(rinsing),washing_completetd are all output given.

complete simulink model, showing that the washing process is completetd.

Here all LED glown a sGreen 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 operation is not completed and green LED shows operation is completed which is also check from display box as output 1.

II.Implementation of control logic for Gear Shift using ststeflow

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 various features from the stateflow window.

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

5.After finishing the control logic run the stateflow and check the gear shift operation for an infinte time.

Blocks used

1.Chart

A finite state machine is a reprentation of an event-driven(reactive) system.in an event-driven system,the system responds to an event by making a transition from one state(mode) to another.This transition occurs if the condition defining the change is true.

2.Display

The Display block shows the value of the input data. You can specify the frequecy of the display. For numeric input data, you can also specify the format of the display.

3.Constant

The constant block generates 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 value and colors to provide the information you want during the simulation.

5.Rocker switch

The Rocker switch block toggles the value of the connected block parameter between two values during simulation. for examples, 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 example, you can connect the slider block to a gain block in your model and adjust its value during the simulation. you can modify the range of the slider block'[s scale to fit your data. use the slider block with other Dashboard blocks to create an interactive dashboard to control your model.

From slide blocki.e Throttle pedal we can change value of vehicle speed while simulation is running.

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 for 2nd gear, the entry condition is 16<=speed and speed<=25 the exit condition is when speed<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 the display block.

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 transition 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 from 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 simulating Gear_shift_logic, Engine[ E=1 ] condition given with various speed change values.

SYMBOLS PANE:

Here,

'E'(Engine on/off) and 'speed' as input given while all other like powerswitch,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_fifith LED is glow green and display output as 1.

At speed=20 kmph

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=48 kmph

At speed 48 kmph which is above 40 kmph 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.