Challenge

Stateflow logic of a Washing Machine and Gear Shift

Aim- To implement control logic of a Washing Machine using Stateflow as per given sequence.

Data-

  • 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

Theory-

Stateflow provides a graphical language that includes state transition diagrams, flow charts, state transition tables and truth tables. We can use Stateflow to describe how MATLAB algorithms and Simulink models react to input signals, events and time-based conditions.

Stateflow enables us to design and develop supervisory control, task scheduling, fault management, communication protocols, user interfaces and hybrid systems.

With Stateflow, we can 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 us to analyze and debug our logic while it is executing. Edit-time and run-time checks ensure design consistency and completeness before implementation.

Model-

Stateflow implementation in Chart

The initial stage when Power Supply is not given

Stage 1 When Power Supply is given

Stage 2 When water supply starts after the power supply is on.

Stage 3 Soaking Started

Stage4 Washing is taking place and Soaking stopped

Stage 5 Rinsing is started and Washing stopped.

Stage 6 Dryer started and rinsing stopped along with it the water supply is also turned off.

Stage 7 After all the processes are completed the completion is indicated by the blue light.

Model Link- https://drive.google.com/file/d/1J3eahwh7r1vHavnie-OVm6oygcknXNAs/view?usp=sharing

Conclusion - Hence we have implemented control logic of a Washing Machine using Stateflow as per the given sequence.

Aim - To make a Simulink chart for the “Gear shift” logic as per given conditions.

Data -

Speed Range 0-15 16-25 26-40 41-60 Above 61
Gear 1 2 3 4 5

Model-

The State flow chart of the model according to the given data.

Simulink Model

Speed between 0-15, display shows gear 1

Speed between 16-25, display shows gear 2

Speed between 26-40, display shows gear 3

Speed between 41-60, display shows gear 4

Speed above 60, display shows gear 5

When the power is off the system will stay off and nothing will be displayed

Model Link - https://drive.google.com/file/d/122-UfdYQ1-I3MixgyEqmmoQhABCQxhsW/view?usp=sharing

Explaination

The state flow chart is made as per the given conditions.

When the Power is given then only the system will work else it will stay off even if the speed is varied. This done using a rocker switch to the power supply and in chart the further stages will conclude when the power is high.

In chart if the power block is connected to the speed. Speed block is further connected to the gear shift mechanism.

The gear shift mechanism is quite simple if the speed is in range of the speed in the block then it will display the corresponding gear mentioned or else it will move forward or backward accoring to the speed. This is similar to if else system..

In the simulink model the speed is given through a constant block, this constant block is connected to a slider where we can vary the speed manually while the simulation is running.

The stop time in this simulation is kept infinite so that while varying speed the simulation will not stop.

The output of the chart is connected a display block, which displays the gear number according to the speed.

Conclusion - Hence we have made a Simulink chart for the “Gear shift” logic as per the given conditions.

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.