Challenge

Week - 4

Aim:

1) To implement a control logic of a "washing machine" using Stateflow for the given sequence.

2) To make a Simulink chart for the "Gear shift" logic for the given conditions.

Given Data:

1. Implement control logic of a “washing machine” using Stateflow as per the 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 the next 20s & dryer runs for 50s

After all the processes have been completed turn on the finished LED

2. Make a Simulink chart for the “Gear shift” logic as per the 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.

Block:

1) To implement a control logic of a "Washing machine"

Stateflow:

In this flowchart, we are assigning a junction for power and water supply. The flow chart has separate state blocks for the operation to satisfy the given sequence.

Symbol Pane:

Power and Water are given as input data.

S,W,R,D and E are given as output data.

Model:

In this model, we used the following blocks they are Slider Switch, Constant, Chart, Display, and Lamp. In the inside chart block, we used states in the chart.

Power and Water are the inputs of the chart block.

State blocks were used inside charts to create a Stateflow as per the given criteria.

The Power is given as input in the chart, Here if Power==1 then the power supply is in ON state. Then the process is directed to the Water block.

If the Power==0, then the Power supply is in OFF state and it is directed to the junction.

In the next state, If Water==1 then the water supply is in On state and process directed to the soaking state.

If the Water==0, then the Water supply is in OFF state and it is directed to the junction.

Next to Water is the Soaking state, Once the soaking state starts after 200 seconds, it directs to the Washing state

Once the Washing state starts, after 100 seconds it directs to Rinsing State

Once the Rinsing state starts, after 20 seconds it directs to Drying State and the process directs to End state after 50 seconds.

Lamp Operation:

The above diagrams show the system is in OFF state. If the Power supply is ON, the system gets activated. If the Water supply is not available, stop the process and indicate through the LED.

The supply can be changed through the Slider Switch. If the power supply is given 1, LED denoting the power is glowing Green which shows the system is activated.

The Water is OFF and LED is denoting red which indicates the OFF state of the water Water supply.

Once the Water supply is given as 1, LED denoting the Water is glowing Green which shows the system is activated.

The Lamp parameters for both Power and Water has assigned to 0,1, and Undefined state. The Zero state indicates in red color, One state indicates in Green Color and Undefined state indicates in Grey color.

After completion of all states, displays show the ON (1) state of all operations and turn ON the END LED.

2) Make a Simulink chart for the “Gear shift”

Stateflow:

Symbol Pane:

In this system, we are assigning Gear as input and G1, G2, G3, G4, G5 as output.

Model:

In this model, We are using Constant block as Gear Input. The constant block is used to vary the input value.

State blocks were used inside the chart to get a conditioned state flow.

First, the input values are generated to the GEAR_SHIFT block. As per our given condition if Gear>0, it proceeds to the next state. If Gear==0, it ends the flow to the junction.

If Gear>0, it moves to Gear 1 state, and when the input value crosses 15, it moves to next state.

If Gear>15, it moves to Gear 2 state, and the Gear<=15, it moves back to Gear 1 state

If Gear>25, it moves to Gear 3 state, and the Gear<=25, it moves back to Gear 1 or 2 states as per the speed level.

If Gear>40, it moves to Gear 4 state, and the Gear<=40, it moves back to Gear 1 or 2 or 3 state as per the speed level.

If Gear>60, it moves to Gear 5 state, and the Gear<=60, it moves back to Gear 1 or 2 or 3 or 4 state as per the speed level.

Each lamp is connected with each gear output. while entering the state, the lamp glows and while exiting the state, the lamp goes OFF.

Display block is connected with each gear output to get the value of 0 or 1, which denotes whether the gear is active state or not.

Stop time is given as inf as stimulation goes on until the user pauses or ends the simulation.

Lamp Parameter:

The above-shown lamp parameter is used for all the Gear State, In the parameter, we have assigned Green Color for "State 1" and Grey color is assigned for "Undefined state".

Conclusion:

A Control logic of a "Washing machine" using Stateflow for the given sequence is implemented and A Simulink chart for the "Gear shift" logic is made.

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.