Challenge

Week - 4

Aim:- create a simulink model by using the chart implement the control logic of a washing machine and also make a simulink chart to for the 'Gear shift' Logic as per given conditions 

Objective:- 

  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

   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. 

Model1:-

This is a state flow diagram for the washing machine operation :-

 

These are the blocks used in the model :-

Chart block :-

  •  The chart block is a graphical representation of a finite state machine consisting of states, transitions, and data.
  • Here we put the logical step to operating the washing machine inside the chart block.

constant block :-

  •  Here constant block is used to input the signal to the chart for the desire operation.
  • The signal is getting from the toggle switch as per the requirement.

Toggle switch :-

  • The Manual Switch block is a toggle switch that selects one of its two inputs to pass through to the output.

  • Here the toggle switch used as a water valve and it is connected with a constant block to give the signal to the chart , water supply is on or off.
  • if the supply is on then  the input value is 1 and if it is off then the input value is 0.

Display :-

  •  The Display block shows the value of the input data. You can specify the frequency of the display.

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.
  • Here the lamp used to indicate the process is completed or not.
  • if the process is not completed , the lamp represent with a  red colour sign, otherwise it show green colour if it is completed.

Washing machine Logic :-

  • In the above control logic first state is created with 2 conditions for power supply .
    One is with power supply available(Power_supply==1)and second with water supply available
    (Water_supply==1).If the power supply at entry is 1 and water supply is on, then machine will get activated and start the next process ofoperation.
  • 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 sec 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 completes it is 1 for every states.
  • We have given water, soak, washing, rinsing, dryer, cycle as Outputs of the chart.
  • We have given our water_supply & power_supply as Inputs of the chart.

Simulation Time parameter :-

  • We used 390 sec so that it can cover the whole cycle and sufficient time to store and solve the parameters.

Output :-

  • There are two condition asked to solve in the questions 

Condition 1:- when the water supply is off

  • From the above diagram, We can see that indicator of water is showing Red i.e., When there is no water supply the process is terminated and LED indicator is used to indicate that state

Condition:-2 when water supply is on

  • Now we on the water supply and check what happends

  • As we can observe from teh above figure, All the states have been executed and indicating the Process completion indicator (named as cycle) showing Green.

Model2:- 

This is the state flow diagram for the gear shift as per the given condition :-

 These are the block used for making above model :-

chart Block :-

  •  The chart block is a graphical representation of a finite state machine consisting of states, transitions, and data.
  • Here in chart Block used for the giving the control Logic for Gear shifting.

Display Block :-

  • The Display block shows the value of the input data. You can specify the frequency of the display.

Constant Block :-

  • The Constant block generates a real or complex constant value signal. Use this block to provide a constant signal input. The block generates scalar, vector, or matrix output, depending on: The dimensionality of the Constant value parameter.
  • Here the constant Block is used to give the speed signal and the Engine power signal.

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

  • Here the Rocker switch is connected with a constant block , in constant block if the input value is 1 then switch is on or if 0 the switch is off.

Slider :-

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

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

  •  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.
  • Five Gear State is created with state condition of gear (G) 1,2,3,4and 5 respectively and their transition is connected with speed range condition as shown.
  • The transitions 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.
  • Here (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 the different speed :-

At speed 80 kmph

At speed 80kmph which is above 61kmph gear 5 is implemented and Gear_5 LED is glow green and display output as 1.

At speed 24 kmph

At speed 24kmph which is above 16kmph gear 2 is implemented and Gear_2 LED is glow green and display output as 1.

At speed 45 kmph

At speed 45kmph which is above 40kmph gear 4 is implemented and Gear_4 LED is glow green and display output as 1.

And thus all condition simulated through stateflow chart successfully

Simulink model link :-

https://drive.google.com/drive/folders/1ZS57fSxUlnh3LRGi2U5Jlsj-vZXEFzVn?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.