Week - 4
Aim:
1. 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 below conditions.
Objective:
1. In Simulink, Implement the control logic of a “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.
2. Create a model for "Gear Shifting" logic as per given conditions. Give the Speed input whilesimulation is running and display the gear number.
Explanation:
1. Implement control logic of a “washing machine” using Stateflow as per given sequence.
STATE FLOW:
Stateflow provides a graphical language that includes state transition diagrams, flow chart, state transition table and truth tables. By using State flow to describes how matlab algorithms and Simulink model react to input siganals, events and time-based conditions.
CONTROL LOGIC:
Control logic is model system logic using state machines, Flowcharts and Truth tables.
Stateflow is simulink tool to implement the stste machine. Here model system logic of a Washing Machine using stateflowhas been done.
Step1: Create a chart and enter the 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 time of 100s
- Then rinsing happens for next 20s and runs for 50s

After all the processes have completed turn on the finished LED
Step2: After entering the input condition in the chart, Go to symbols pane and assign the given variable.(Example: input data, output data, etc...)
Step3: Give the input values of turnning onor off for the Power Supply and Water Supply.
Condition:
if value = 1, Power and Water Supply will turn On.
if value = 0, Power and Water Supply will turn Off.
Step4: Use 'display' block and 'Lamp' indicator to display the results.

OUTPUT:
Control logic of washing machine using state flow has been implemented.
Case 1:
If the Power Source = 0; and Water Source = 1; then power supply is not avialable 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 will not be avialable 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 will be avialable and so system will activate and after all process completed and lamp will turn on.

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.
Gear shifting mechanism
Mechanical devices that enable the driver to engage gears in such a way to obtain the desired transmission ratio are called Shifting Mechanisms.
Explaination of Gear Shifting Mechanism using Simulink:
Step1: 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
Above 61 5
Step2: After entering the input condition in the chart, Go to symbols pane and assign the given variable.(Example: input data, output data, etc...)
Step3: Connect the 'Slider Gain' to varry the speed while simulation is running.
Step4: Create Constant and giving value 1 and 0 for on and off.
Step5: Create Lamp to indicate the power on or off.
Step6: Use Display block to indicate the Gear position.
Gear Shifting Logic has been created and by using "Slider Gain" block to varry the speed while running the simulation.

Case1:
If the Key = 0, then the power will turn off, Lamp indicate the red colour and Gear shifting mechanism will not activate.

Case2:
If the Key = 1, then the power will turn on, Lamp indicate the purpal colour and Gear shifting mechanism will activate.

Case3:
By varying speed (Parameter) in the Speedometer(Slider Gain),Gear position will change according to the given condition.

Given speed = 30Km/hr in speedometer,if the speed is between 25Km/hr - 40Km/hr 3rd Gear will activate as per the given condition Gear position displayed below in the simulink model.

Likewise, changing the speed in speedometer according to the given condition, Gear positon will change.