Week - 4
Aim:- 1) To implement control logic of a "washing machine" using stateflow as per given sequence.
2) Make a simulink chart for the 'Gear shift' logic as per given conditions.
Objectives :-
1) Implement a control logic of a washing machine using stateflow as per given sequence.Create a model and operate the model logic system and display the output results by a lamp indicator.
2) Create a model for 'Gear shifting logic' as per given conditions.Give the speed input while simulation is running and display the gear number.
Explaination:-
Stateflow: Stateflow provides a graphical language that includes state transition diagrams,flow charts,state transition tables and truth tables.By using stateflow to describe how matlab alogorithms and simulink models react to input signals,events and time based conditions.
Control logic: It is a model system logic using State machines,flowcharts and truth tables.
Task1 - Control logic of washing machine using stateflow:-
Create a chart and give the input conditions as below
1) If the power supply is available the system gets activated.
2) If the water supply is not available stop the process and indicate through LED lamp.
3) Soaking time should be 200 seconds followed by washing time of 100 seconds.
4) Then rinsing happens for 20 secs and then drying for 50 secs.
After giving the input conditions in the chart, go to symbols pane and assign the given variable.
Give the input values for turning ON or OFF for the power supply and water supply.If the value=1 Power and water supply will turn ON and if value = 0 Power and water supply will turn OFF.Use 'Display' block and 'Lamp' indicator to display the results.
Results:-
Case1) If the power supply = 0,system is not activated and all lamps turn RED
Case2) If the power supply = 1 but water supply = 0 only the lamp associated with Power will turn GREEN and others remain RED indicating that the system is inactive
Case3) If the power supply =1 and water supply = 1 then the system gets activated and all lamps turn GREEN w.r.t the simulation time.
Task2 -
Gear shifting mechanism:- Mechanical device that enables the driver to engage gears in such a way as to obtain the desired transmission ratio is called 'Gear shifting mechanism'.
Create a chart and enter the given conditions for gear shifting.
Speed range (kmph) Gear
0 to 15 1
16 to 25 2
26 to 40 3
41 to 60 4
61 and above 5
*After entering the given conditions in the chart , go to symbol pane and assign the given variables(example input data , output data etc.) Connect the slider gain block to vary the speed while simulation is running.
*Create a constant block and give the value 1 or 0 to turn ON or OFF
*Create a lamp to indicate the power ON or OFF
*Use display blocks to display the speed and Gear position
Output :-
Case1) If the power = 0 (constant block), then the power will turn off and the lamp indicates RED and the Gear shifting mechanism is not activated.
Case2) If the power = 1 , then the power turns ON and lamp turns GREEN and the Gear shifting mechanism will be activated. Now by varying the speed in the speedometer we can observe the Gear position and speed from the display blocks which are connected to value from the chart.
Simulink files and results are provided in the links.