Challenge

Week - 4

1.

AIM: Implement control logic of a “washing machine” using Stateflow as per given sequence.

OBJECTIVE:

1. If the power supply is available, the system gets activated

2. If the Water supply is not available, stop the process & indicate through LED

3. Soaking time should be 200s followed by Washing time of 100s.

4. Then rinsing happens for next 20s & dryer runs for 50s

5. After all the processes have completed turn on the finished LED

Stateflow: Stateflow provides a graphical language that includes state transition diagrams,flow charts,state transition tables,and truth table. It is used to describe how Matlab algorithms and simulink models react to input signals, events, and time-based conditions. Stateflow enables you to design and develop supervisory control, task scheduling,fault management,communication protocols, user interfaces, and hybrid systems. With Stateflow, you model combinatorial and sequential decision logic that can be simulated as a block within a Simulink model or executed as an object in MATLAB. Graphical animation enables you to analyze and debug your logic while it is executing. Edit-time and run-time checks ensure design consistency and completeness before implementation.

Control logic: Control logic is the part of a controller that defines how a reactive system responds to events or conditional changes. Supervising how to switch between different modes of operation. Scheduling a sequence of tasks or steps for a system. Defining fault detection, isolation, and recovery logic. Modeling hierarchical state machines for large-scale systems. Adding flow charts to define complex control logic.

Procedure:

1. Create a chart block for defining the state flow as per given condition.

2. Inside it, the circular junction is to terminate the signal flow and return a null value.

3. If power is OFF i.e. 0, the process is terminated at the junction else 1 is carry forwarded.

4. If water is OFF i.e. 0, the process is terminated at the junction else 1 is carry forwarded.

5. After 200 sec of soaking, wash block gets activated and washing action takes place.

6. After 100 sec of washing, rinse block gets activated and rinsing action takes place.

7. After 20 sec of rinsing, dry block gets activated and drying action takes place.

8. After 50 sec of dry, finish block gets activated. Finish is to terminate the signal flow in the process and exits the chart.

9. Define power and water as inputs whereas soak, wash, rinse, dry, finish as outputs.

10. Connect the chart blocks with constant blocks for power and water inputs. Input switches connected to them are a slider switch and toggle switch respectively. Attach lamps to observe the ON/OFF condition.

11. A common scope is connected to observe the entire washing process and obtain the output plot.

A simulink model for operating the washing mechine according to given condition below:

Stateflow:

Inuput:

Power ON, Water OFF:

Power ON, water ON, t=0 sec

Power ON, Water ON, Soak ON, t= 10 sec

Power ON, Water ON, Wash ON, t=230 sec :

Power ON, Water ON, Rinse ON, t=330sec:

Power ON, Water ON, Dry ON, t=380sec:

Power ON, Water ON, Finish ON, t=500sec:

2.

AIM: Make 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.

THEORY: The transmission box which is known as a gearbox is the second element of powertrain in an automobile. It is used to change the speed and torque of the vehicle according to a variety of load conditions. The transmission box changes the engine speed in to torque when climbing hills and when the vehicle required. sometimes it is known as a torque converter.

WORKING: In a gear box the counter shaft is meshed to the clutch with the use of a couple gears. so the counter is always in running condition. When the counter shaft is brought in contact with the main shaft by the use of meshing gears, the main shafts starts to rotate according to the gear ratio. When the driver wants to change the gear ratio, simply press the clutch pedal which disconnects the counter shaft with the engine and connects the main shaft with the counter shaft by another gear ratio by use of gear shift lever.

PROCEDURE:

1. Create a chart block for defining the stateflow as per the given condition.

2. Inside it, the circular junction is to terminate the signal flow and return a null value.

3. If ignition is OFF i.e, 0, the process is terminated at the junction else 1 is carry forwarded.

4. If speed is lessthan or equal to 0, the flow is terminated and gear is 0 activated, at the junction else 1 is carry forwarded.

5. If speed is greater than 0 and less than or equal to 15, the flow is terminated and gear 1 is activated.

6.If speed is greater than 15 and less than or equal to 25, the flow is terminated and gear 2 is activated.

7. If speed is greater than 25 and less than or equal to 40, the flow is terminated and gear 3 is activated.

8. If speed is greater than 40 and less than or equal to 60, the flow is terminated and gear 4 is activated.

9. If speed is greater than 60, the flow is terminated and gear 5 is activated.

10. Define ignition and speed as inputs where as speedometer,scope and gear number display as outputs.

11. Connect the chart block with constant block for ignition and speed inputs. Inputs switchs connected to them are slider switch and a slider bar to adjust variable speeds respectively. Attach lamps to observe the ON/OFF condition.

12. A common scope block is connected to observe the speed numerically and obtain the output plot.

A Simulink model for operating the gear shift mechanism according to given condition is shown below:

Stateflow:

Ignition ON, Speed 0 Gear number 0:

Ignition ON, Speed 0 to 15, Gear number 1 :

Ignition ON, Speed 15 to 25, Gear number 2:

Ignition ON, Speed 26 to 40, Gear number 3:

Ignition ON, Speed 41 to 60, gear number 4 :

Ignition ON, Speed 60 and above, gear number 5:

Conclusion:

Hence, the given problem is simulated for washing machine and gear shift mechanism and excuted the stateflow as per given condition.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.