Week - 4
- 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 A; state flow provides a graphical laguage that include state transtions diagram flow chart state flow transtion tables and truth tables you can use chart flow to descride how matlab algorithms and simulink models react to input singals events and time -based conditions CHART A stateflowe chart is a graphical reperesntion of a finite state machine consisting of states tranition and data you can creat a state flow chart A1 STEPS OF WASHING MACHINE 1 SOAKING 2 WASHING 3 RINSING 4 DRYING Conditions if power is ON the system should be activated .the process should taken place when water supplyis avaliable or eles stop the process whith lndicating LED SOAKING TIME IS 200 SECONDS. WASHING time is 20 seconds RINSING time is 20 seconds DRYING TIME IS FOR 50 SECONDS After compeletion of all process finsihed LED should glow Procedure; 1` open mat lab for creating the model 2 add two constant blocks from the library or by double clicking on screen and serach for blocks.add slider switches for both constant blocks .add slider switches contains two value .0 is off consition and 1 for ON condition .connect the slider. switches with constant block of power and water .sliderswitches areautomatically changed when the value are changedfor constant blocks . and add chart block for the logic that need to be appliedwashing machine chart block is a state flow logic used in this model .after adding open it by double clicking on it. in chart logics are applied by using states and connections each and every process starting with power process continues for next step else terminates the whole logic addanother state for power by giving entry a=1 .jion these two with a condition p==1.when the power and water supply is available washing machine processes taken places .add state for washing with and entry c=0 d=1 .join withthe soaking state with a condition after 200seconds .this can be given after 200 seconds ,this cann given by after 200seconds.add state for rinsing with and entry d=0 ,e=1 .jion with the washing state with condition afer 100 seconds this can be given by after 100 seconds . by given inputs data for p and w for a,b,c,d,e,f,g,h given output data . come back to main modle which you can observe input and output port avaliable for chart ,connent constant blockwwwith input ports and given display blocks for all outputs. model ishow below and save the file run the simulatiom with 500 seconds. MODEL ON CONDITION FORBOTH POWER AND WATER SUPPLY
CHART
Parameters in chart
Conditions; when the power is off and water supply is on .the process does not takes places even though water esupply is available since the power is off the system gets activated when power is available only.
Condition 2; when the power is ON and water supply is off .since ithe power is available and water supply is unavailable washing does not takes places and no water lamp light up
observation step -wise procedure is exaplained step 1; when the power and water supply is on soaking taken places for 200 seconds lamp lights during this process
step2 the next step is washing.it tsakes places for 100 seconds.washing lamp lights during this process.
Step3; the next step is rinsing .it taken place for 20 seconds .rinsing lamp light during this process
step4 the next step is drying .it taken places for 50 seconds .drying lamp lights during thisprocess
step5; after comletion of all processes finished buld with light up.
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.
A gear shifting is used for inreasing or decrearing the speed torque or power of an engine by higher to lower or lower to higher gears .in the below figure we can see the gear shift rod for manual tarnsmission vehicle it is used to change the gears in between according to the required speed
CONDITION;
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
Above 61 5 Procedure; open the matlab. creat a new blank model.add a constant block and chart .open chart by double clicking on it.create states for each and every gear that needed to be changed frist createa state for input taking the values and name it as gear. create annother state with gear1 and entry as a=1 join with the previous state with a condition. s>0.creat a new state for seconds gear as naming it as gear2 .since there is a range of speed for each and every gear we use joining in both direction . gear1 to gear2 is given by and in reverse and save the file and the run the simulation on slider we makes chades for speed values MODEL
CHART
PARAMETERS;
GEAR1 When value for speed is changed in between 0-15
GEAR2 When value for speed is changed in between 16-25
GEAR3 when value for speed in between 26-40
GEAR4 When value for speed in between 40-60
GEAR5 When value for in between above 60 the display show
Scope ;output is plotted when the gear shifing is done from lower to higher and vice
output is plotted when the gear shifiting is done from lower to higher and vice versa
- Then rinsing happens for next 20s & dryer runs for 50s