Challenge

Week - 4

AIM:-

Implement control logic of a “washing machine” and “Gear shift” using Stateflow .

OBJECTIVE:-

  1. Implement 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

2. 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.

STATEFLOW:-Stateflow provides a graphical language that includes state transition diagrams.flow charts state transition tables and truth tables.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 tast scheduling,fault management,communication protocols.user interfaces and hybrid systems.With stateflow you model combinational and ssequential 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 analysed and debug your logic while it is executing.Edit-time and run-time checks design consistency and completeness before implementation

CONTROL LOGIC:- Control logic is a key part of a software program that controls the operstions of the program.The control logic responds to commands from the user and it also acts on its own to perform automated tasks that have been structured into the program.Control logic can be modeled using a state diagram which is a form of hierachical state machine.

PROCEDURE:-

1.create a chart block for defining the stateflow as per the given conditions.

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 soack block gets activated and socking action takes place.

6.After 200 sec of soaking.wash blocks gets activated and washing action takes palce.

7.After 100 sec of washing Rise block gets activated and rinsing action takes palce.

8.After 20 sec of rinsing.Dry block gets activated and drying action take place.

9.After 50 sec 0f dry.Finish block gets activated.Finish is to terminate the signal flow in the process and exits the chart.

10.Define power and water as inputs whereas soak,wash,rinse,dey,finish as outputs.

11.Connect the chart block with constant blocks power and water inputs.Input switches connect to them are slider switch and a toggle switch respextively.Attach lamps to observe the ON/OFF condition.

12.A common scope block is connected to observe the entire washing process and obtain the output plot,Blue color in the lamp indicates that the process is complete.

SIMULINK MODEL:-

STATE FLOW:-

SCOPE:-When both switch are closed

INPUT:1

POWER ON,WATER OFF

POWER ON,WATER ON,t=0sec

POWER ON,WATER ON,t=200sec

POWER ON,WATER ON,t=230sec

POWER ON,WATER ON,t=400sec

POWER ON,WATER ON,t=550sec

POWER ON,WATER ON,t=600sec

2.GEAR SHIFT MECHANISM:-

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

PROCEDURE:-

1.create a chart block for defining the stateflow as per the given conditions.

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 less than or equal to 0.the flow is terminated and the gear 0 is activated at the junction else 1 is carry forwarded.

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

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

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

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

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

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

11.Connect the chart block with constant blocks power and water inputs.Input switches connect to them are slider switch and a toggle switch respextively.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.

SIMULINK MODEL:-

STATE FLOW:-

IGNITION ON,SPEED O,GEAR 0

IGNITION ON,SPEED O-15,GEAR 1

IGNITION ON,SPEED 16-25,GEAR 2

IGNITION ON,SPEED 26-40,GEAR 3

IGNITION ON,SPEED 41-60,GEAR 4

IGNITION ON,SPEED ABOVE 60,GEAR 4

CONCLUSION:-

Hence the given problem was simulated for the washing machine and gear shift mechaism and executing the stateflow as per according to given conditions.

GOOGLE DRIVE LINK:-

https://drive.google.com/drive/folders/1wzZ6-H7jv4csZc9d-2eQxI67pP9HSVPA?usp=sharing

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.