Create "Washing Machine" and "Gear Shift" Logics using State Flow of Simulink
- Create 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
MODEL DESIGNED:
The model shows the lamp indicators that represent signal value as ON or OFF for 1 & 0 Respectively,and the constant is the input given by the switches connected to it giving the command as input for the stateflow for the control logic of washing machine.The output from the state logic is connected to the scope wihich displays the graph i.e, the run time for the each operation.
Lights are placed along the side of the output file which shows the operation in action for clear understanding of the machine’s operation being done.
The above image shows the input by the switch to the constant block which gives signal for the washing machine’s stateflow.
The state flows shows the control logic for the washing machine, the operations on the logic are
- Soaking
- Washing
- Rinsing
- Drying
The operation are performed for certain period of time in which as per the case, Soaking time for 200s.Washing time for 100s, rinsing happens for next 20s & dryer runs for 50s.Initially finish is assigned as Zero, when power and waters enters the phase it checks the conditions then allows to pass through.After the completion of soaking for 200seconds it enters next operation of washing for 100seconds, then to rinsing for 20seconds and dryer for 50seconds and during completion the logic circuits enters the finish state, in which goes out and indicates the final call as finish in list of indicators in simulink window.In the above window the looping is done in which it can be avoided as it being a continous process of washing process which is not ideal.This is to showcase that it flows continous process back to the top that the finish state is giiven zero as mentioned earlier.
The Scope gets output from the stateflow and gives the relationship between Time and signal received by the state and being done is clearly explained in the screenshot above
WORKING:
To the simulate the state logic as per case need 400, even though operation cycle completes in 370seconds, can be given which is base for completion of the flow 1st mark on the image explains the input time for the simulation stop time 2nd mark explains the simulation speed to be shown in which choosen as 1
RESULTS:
SOAKING OPERATION:
Soaking operation is being done and it will take up to 200 seconds.
WASHING OPERATION:
Washing is done for 100seconds
RINSING OPERATION:
Rinsing is done for 20seconds.
DRYER OPERATION:
Dryer will be running for 50seconds.
FINISH LIGHT INDICATION:
and after completion of all operations,finish will be lit finally.
--------------------------------------------------------------------------------------------------------
- Create 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.
MODEL DESIGNED:
The model shows the lamp indicators that represent signal value as ON or OFF for 1 & 0 Respectively,and the constant is the input given by the switches connected to it giving the command as input for the Slider gain, which can be used as real time slider value within limits, here the limits are 0-100 .Next, the Dashboard meter is attached to the slider gain and stateflow box is attached to the display board
The state flow describes the logic to be followed, in which the conditions are specified through flow path between the states, and the gear number specified in the boxes.With the input from the slider it chooses the gear according to the conditions and if the condition gets satisfied it is displayed on display board.
The speed conditions are
Speed Range(kmph) Gear
- 0 to 15 1
- 16 to 25 2
- 26 to 40 3
- 41 to 60 4
- Above 61 5
RESULTS:
In this the condition of the key is in off state so the slider input is not considered during stimulation.The input time is given as infinity.
Gear 1:
Gear 2:
Gear 3:
Gear 4:
Gear 5:
The above results depicts the results of gear variation with respect to the throttle limits