Challenge

Week - 4

TASK-1:
AIM:
      'To implement control logic of a washing machine using stateflow in Simulink'.


OBJECTIVE:
1.To implement the control logic of a washing machine using stateflow as per given 
  sequence:
a) if the power supply is available, the system gets activated.
b) if the water supply is not available, stop the process and indicate through LED.
c) Soaking time should be 200s followed by Washing time of 100s.
d) Then rinsing happens for next 20s and dryer runs for 50s.

After all the processes have completed turn on the finished LED.


MODEL:
    The file which contains the model is attached with this report.

    Pictorial Representation of Block Diagram:
Blocks Used:
1. Chart:
     A finite state machine is a representation of an event-driven (reactiv) system. In an event-driven system, the system responds to an event by a transition.
     From one state (mode)to another. This transition occures if the condition defining the change id true.


2. Display:
    The display block shows the value of the input data. You can specify the frequency of the display. For numeric input dta, You can also specify the format of the display.


3. Constant blocks:
     we use 2 constant blocks to 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 signals. you can use the lamp block with other Dashboard block to build an interactive.
    dashboard of control and indicators for your model. You can specify pairs of input values 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 example,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 sipply 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 the soaking and the rinsing process. the timing for each state is as per 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 logic first state is created with 2 conditions for power supply.

One is with Power supply avaolable (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 operations stste 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 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,

Power Switch & W(water supply) is as input given while all other like 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 display output as 1.



Simulink Model, Showing that power switch and Water supply is off then all the processes are stop hence lamps are pink and output is 0.

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.

Ans=>
Part II: IMPLEMENTATION OF CONTROL LOGIC FOR GEAR SHIFT USING STSTEFLOW.

PROCESS:
1. State simulink and create a blank model.
2. Search for CHART block in the ststeflow category of library browser.
3. Open the chart block and select the various from the ststeflow 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 ststeflow and check the gear shift 
   operation for an infinite time.


Blocks Used:
1. Chart
   A finite state machine is a representation of an event-driven (reactive) system. In an event-driven system, the system responds to an event by makink a transition from one stste (mode) to another. This transition occures if the condition defining the change is true.


2. Display
   The Display block shows 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 Constant block generates a real or complex constant value signal. Use this block to provide a constant signal input.


4. Lamp
     The Lamp block display 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.

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 stste 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 blocks scale to fit your data. Use the Slider block with other Dashboard blocks to create an interactive dashboard to control your model.


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


Logic Explanation:
    The speed ranges from 0 to 100 and 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 ststes.


2. Five Gear state is created with state condition of gear (G) 1,2,3,4 and 5 respectively 
   and rheir 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 reverde 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 PAN:

Here,
'E' (Engine on/off) and 'Speed' as input given while all other like power Switch,Gear_second,Gear_third,Gear_fourth,Gear_fifth are all as output given.



Simulink Model at different speeds


- At Speed = 80 Kmph

At speed 80 Kmph which is above 61 Kmph gear 5 is implemented and Gear_fifth LED is glow green and didplay 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.
And thus all condition simulated through stateflow chart sucessfully.
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.