Challenge

Week - 4

Aim:To 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

Answer:-

part-1:- Implement control logic of a “washing machine” using Stateflow as per given sequence :

  • start simulink and create a blank model.
  • Search for the chart block in the stateflow category of library browser.
  • Open the chart block and select the junction feature from the stateflow window.
  • Control logic for the washing machine is such that it should soak the water for the first 200 sec followed by washing time 100 sec. Rinsing the water for the next 20 sec followed by drying time of 50 sec
  • After finishing control logic run the stateflow and check sequence of operation for 370 sec

Blocks Used:-.

Chart:-

It is a graphical representation of a finite state machine consisting of states, transitions, and data.

Display:-

The display block shows the value of the input data.You can specify the frequency of the display.For numerical input data,you can specify the format of the display.

Constant:-

The constant block generates a real or complex constant value signal.Use this block to provide a constant signal input.

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



Rocker Switch:-The Rocker switch toggle the value of connected block parameters between two values during simulation.for example you can connect the Rocker Switch block in your model and change in state during simulation







Logic Operation for Washing Machine:-



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

One is the power supply available (Power Switch==1) and second with water supply (W==1).If the supply at entry 1 and water supply is on, Then the machine will gets activated. And starts the next process of operation

Symbols Pane:-

Completed Showing the process that Washing is completed.

Here the Green Led shows the process is Completed.








Part 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

Answer:-

Part2:- Implement control logic of a “Gear Shift” using Stateflow as per given sequence

Process

  • start Simulink and create a blank model.
  • search for a chart block in the stateflow category of library browser.
  • Open the chart block and select the junction feature from stateflow window.
  • control logic for gear shift search that it should change the gear when the speed increases and decreases automatically.
  • After finishing Control logic run the stateflow and check the gear shift sequence for the infinite time period

Blocks Used:-

Chart:-

It is a graphical representation of a finite state machine consisting of states, transitions, and data.

Display:-

The display block shows the value of the input data.You can specify the frequency of the display.For numerical input data,you can specify the format of the display.

Constant:-

The constant block generates a real or complex constant value signal.Use this block to provide a constant signal input.

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

Rocker Switch:-

The Rocker switch toggle the value of connected block parameters between two values during simulation.for example you can connect the Rocker Switch block in your model and change in state during simulation




Slider Gain:

The Slider block tunes the value of the connected block parameter during simulation. For example, you can connect the Slider block to a Gain block in your model and adjust its value during 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.

Logic Operation:-



  1. In above control logic,the first engine is started from input switch E=0/1 through Rocker Switch which is a power switch to make engine ON. Then next Gear-shift-logic implemented through following steps
  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 shown in below conditions:
  3. The transition condition for the gear shift is given as
  • speed>15 it shifts to G=2
  • speed>25 it shifts to G=3
  • speed>40 it shifts to G=4
  • speed>60 it shifts to G=5,When speed is increasing for 0-60 kmph

Similarly in Reverse Direction:-

  • speed<60 it shifts to G=4
  • speed<40 it shifts to G=3
  • speed<25 it shifts to G=2
  • speed<15 it shifts to G=1,When speed is decreasing for 60-0 kmph

While Simulating Gear_shift_logic,Engine [E==0] Condition given as various speed change values.

Symbols Pane:-

Simulink Model at different Speeds:-

At speed 70 kmph

At speed 72 kmph is implemented in gear 5 and the output Gear_fifth in BLUE LED and output will be same in 1

At speed 48 kmph

At speed 48 kmph it is implemented as gear 4 and the Gear_fourth is blue and the output is same as 1

At speed 22 kmph

At speed 22 kmph it is implemented as gear 2 and the Gear_second is blue and the output is same as 1

And thus all conditions simulated the 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.