Week - 4
1.AIM:
- To implement control logic of Washing machine using stateflow as given sequence.
- Make a Simulink chart for the 'Gear Shift' logic as per given conditions.
2. OBJECTIVE:
- In simulink Implement the control logic of Washing Machine using Stateflow as per given input conditions.Create a model and operate the model logic system and display the output of the results by using Lamp Indicator.
- Create a model for Gear Shifting logic as per given conditions.Give the Speed input while simulation is running and Display the number.
3. EXPLANATION:
STUDY 1:
STATEFLOW:
Stateflow provides a graphical language that includes state transition diagrams,flowcharts,state transition tables,and truth tables.By using Stateflow to describe how MATLAB algorithms and Simulink models react to input signals,events and time based conditions.
CONTROL LOGIC:
Control logic is a model system logic using state machines,flowcharts and truth tables.
EXPLANATION FOR CONTROL LOGIC OF A WASHING MACHINE USING STATE FLOW:
State Flow is a simulink tool to implement the state machine.Here model system logic of a Washing Machine using state flow been done.
Step 1: Create a chart and enter the given input conditions.
Given input conditions:
- If the power supply is available the system gets activated.
- If the water Supply is not available, stop the process and indicate through LED.
- Soaking time should be 200s followed by Washing Machine of 100s.
- Then rinsing happens for next 20s & dryer runs for 50s.

After all the processes have completed turn on the finished LED.
Step 2: After entering the input conditions in the chart. Go to symbols pannel and assign the given vaiable.(Example: input data,Output data,etc..)
Step 3 : Give the input values for the turning ON or OFF for the Power Supply and Water Supply.
Conditions:
if value=1 , Power and Water Supply will turn ON.
if value=0 , Power and Water Supply will turn OFF.
Step 4 : Use 'Display Block' and 'Lamp Indicator' to display the results.

STUDY 2 :
GEAR SHIFTING MECHANISM:
Mechanical devices that enable the driver to engage gears in such a way as to obtain the desired transmission ratio are called shifting mechanisms.
EXPLANATION FOR GEAR SHIFTING MECHANSIM USING SIMULINK:
Step 1 : Create a chart and enter the given conditions for gear shifting.
Given Conditions:
| Speed Range(Kmph) | Gear |
| 0 to 15 | 1 |
| 16 to 25 | 2 |
| 26 to 40 | 3 |
| 41 to 60 | 4 |
| above 61 | 5 |

Step 2 : After enetring the input conditions in the chart , Go to Symbols pane and assign the given variable.(Example:input data , Output Data, etc....)
Step 3 : Connect the 'Slider Gain' to vary the speed while simulation is running.
Step 4 : Create constant and giving value 1 and 0 for turning ON & OFF.
Step 5 : Create 'Lamp' to indicate the power is ON & OFF.
Step 6 : Use 'Display Block' to display the Gear Position.

4. OUTPUT:
STUDY 1 :
Control Logic of a Washing Machine using Stateflow has been implemented.
Case 1 :
If the Power Source = 0 , Power Supply is not available and system will not activate.

Case 2 :
If the Power source=1 and Water Source=0, then Power Supply will turn ON and Water Supply wiil not be available and so system will not activate.

Case 3 :
If the Power source=1 and Water Source=1, then Power Supply will turn ON and Water Supply wiil be available and so system will activate and after all process completed end lamp will turn ON.

STUDY 2 :
Gear Shifting logic has been created and by using 'Slider Gain' block , to vary the speed while running the simulation.
Case 1 :
If the key=0 , then the power will turn OFF, Lamp indicate the Red colour and Gear Shifting mechanism will not activate.

Case 2 :
If the key=1 , then the power will turn ON, Lamp indicate the Green colour and Gear Shifting mechanism will activate.
Case 3 :
By varying the speed (Parameter) in the speedometer (Slider Gain) , Gear position will change according to the given condition.

Given Speed=30 km/hr in the Speedometer, if the speed is between 25 km/hr - 40 km/hr 3rd Gear will activate as per the given condition. Gear position is displayed below in the Simulink Model.

Likewise,changing the speed in the Speedometer according to the given condition Gear position will change.
5. RESULTS:
- Thus the control logic of a washing machines using stateflow is processed as per the given sequence and LED lights are turns to the Green colour and the system is completed.
- A simulink model is created for the gear shift logic and using slider gain the values are obtained.