Week - 4
washing machine logic.
ans- open simulink ,then double click on screen type chart .chart is the block in which we can draw or project our state flow logic .
as we can see there number of state for the washing machine logic , power,water,soaking,washing ,ect etc.
so here we need 8 state block for the logic need to be created ,Start,power ,water soaking,washing,rinsing,dryer,finish.
now number 1 block represent the start state where there is a arrow shown on the block that arrow indicates the defaut transsion mean our logic wiil start from that block .
followed by power block ,connect the start block to power block by giving condition power==1
same connect the water block givung the condition water==1
then connect the soaking block then connect the washing block,now soaking should be done for 200 sec so between soaking and washing or before washing give the condition after(200,sec)
means that soaking will be done for 200 sec before washing.
Now connect the washing block to rinsing block and give the condition after(100,sec) wshing will carried out for 100 sec
Now rinsing block connects to dyer block and then to finish block give the condition after(20,sec)
and After(50,sec) .
go to modelling click on symbol pane
now give the power and Water as Input and remainging are the output.
get out of the chart and connect the 2 constant block for the power and water and connects the display for the output five 1 and 0 as inputs to constant block obverser the simulation .
2)gear shift logic
Now ther are 5 gear each gear operates between the speed for ex. gear 1 is in opeartion for 0to 15 speed
gear2 16 to 25
gear 3 for 26 to 40
gear 5 for 41 to 60
simulink-chart-state
here we require 6 state block 1 state for gear and the other 5 for 5 gears .
the 1 gera block connet to GEAR_1 give the connditon [speed>0]
mean it will only operate when the input speed is greater then the 0
now connect the GEAR block to GEAR_1 giving the condition of speed >15 ,bsz the 1 gear speed limit is 0to15
now connect GEAR_1 block to GEAR by giving the conditon speed<15
means when the speed is less then condition it will reversed the flow of logic
now connetc GEAR_1 to GEAR_2 giving the condition speed >25 AND reveresed condition speed<25
NOW connects the GEAR_2 to GEAR_3 ,GEAR_3 to GEAR_4 ,GEAR_4 to GEAR_5
all should be connected in reversed condiotn and forward condition with speed limits value
(speed> )and (speed< ) now give the symbols pane to the function speed is input and GEAR is output
come out of the chart connets the constant block to speed and dsiplay to GEAR output
give the vaules in the constant block between 0 to 60 and observe the GEAR number in the display.
NOTE- while Working in the stateflow chart ALways give a keen focus on the Nanimg of the block
AND condtion which we give the name to it ,it shoud match everywhere
also Observe the (breakets,equals too, Quma, and the require symbols int the chat Otherwise the programm can generate the ERROR)