Challenge

Week - 4

AIM:

  1. IMPLEMENT CONTROL LOGIC OF A "WASHING MACHINE" USING STATEFLOW.
  2. IMPLEMENT CONTROL LOGIC OF A "GEAR SHIFT" USING STATEFLOW.

STATEFLOW:

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

Stateflow enables to design and develop supervisory control, task scheduling, fault management, communication protocols, user interfaces, and hybrid systems. With Stateflow, you 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 you to analyze and debug your logic while it is executing. Edit-time and run-time checks ensure design consistency and completeness before implementation.

To start Stateflow it will be done in CHART BLOCK which looks like,

1. IMPLEMENT CONTROL LOGIC OF A "WASHING MACHINE" USING STATEFLOW:

LOGIC CONDITION:

The logic condition for controlling Washing Machine,

  1. If the power supply is available, the system gets activated or gets deactivated
  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 the next 20s & dryer runs for 50s
  5. After all the processes have completed turn on the finished LED

STATEFLOW LOGIC IMPLEMENTATION:

Stateflow logic is implemented by chart block, in chart block we can create the continuous and discontinuous control logic system.

  1. First, we give the logic for power supply, when the on condition is 1 its power on, and when the on condition is 0 its power off.
  2. The input value is either 0 or 1 to control the logic for the power supply with the condition [input<0] is for on condition and [input~=1] for off condition.
  3. second, we give the logic for water supply, when the x condition is 1 its water supply is on, and when the x condition is 0 its water supply is off, and processes are not running.
  4. The input value is either 0 or 1 to control the logic for the power supply with the condition [input<0] is for on condition and [input~=1] for off condition.
  5. If the water is present we give the action for Soaking to perform for 200 seconds, after(200, sec) with soaking y = 1 for start and y =0 to end. here y is the output for the Soaking process.
  6. After soaking completed another action is going to perform which is washing.
  7. The washing going to take action for 100 seconds, after(100, sec) with washing z = 1 for start and z =0 to end. here z is the output for the Washing process.
  8. After washing completed another action is going to perform which is rinsing.
  9. The rinsing going to take action for 20 seconds, after(20, sec) with washing a = 1 for start and a =0 to end. here 'a' is the output for the rinsing process.
  10. Here in the rinsing process, the water supply is going to stop which is x =0.
  11. After rinsing completed another action is going to perform which is dryer.
  12. The dryer going to take action for 50 seconds, after(50, sec) with washing b = 1 for start and b =0 to end. here 'b' is the output for the dryer process.
  13. After the dryer process ended it gives the LED indicator saying FINISHED the process.

Here the Stateflow control logic is a discontinuous system which is a single cycle system.

SIMULINK BLOCK DIAGRAM:

SIMULINK EXPLANATION:

  1. In the simulation, the input is taken as constant as either 0 or 1 value.
  2. The input value is either 0 or 1 to control the logic for the power supply with the condition [input<0] is for on condition and [input~=1] for off condition.
  3. The output is taken as "ON" for the power supply condition. By using lamp block if the value is 0 it's in OFF condition with the color red, and if the value is 1 it's in ON condition with the color green.
  4. The output of the water supply is taken as "x" either 0 or 1 value. By using a lamp block if the value is 0 it's in the water supply is OFF condition with the color red, and if the value is 1 it's in the water supply is ON condition with the color green.
  5. The output for soaking, washing, rinsing, dryer are taken as the variable of y for soaking, z for washing, a for rinsing, b for dryer.
  6. For each time period states are going to change from one state to another.
  7. When the water supply is present the soaking process takes place for 200 sec then it indicates the soaking process LED to green, after 200 seconds the soaking process turns to red which means stop the soaking and changes to the washing state.
  8. The washing process takes place for 100 sec then it indicates the washing process LED to green, after 100 seconds the washing process turns to red which means stop the washing and changes to the rinsing state.
  9. The rinsing process takes place for 20 sec then it indicates the washing process LED to green, after 20 seconds the rinsing process turns to red which means stop the rinsing and changes to the dryer state. At the end of the rinsing process, the water supply going to stop.
  10. The dryer process takes place for 50 sec then it indicates the washing process LED to green, after 50 seconds the washing process turns to red which means stop the dryer. And gives the finish LED indicator.

SIMULINK BLOCK DIAGRAM OUTPUT IN GUI (GRAPHICAL USER INTERFACE):

2.IMPLEMENT CONTROL LOGIC OF A "GEAR SHIGT" USING STATEFLOW:

LOGIC CONDITION:

The logic condition for controlling Washing Machine,

  1. Speed Range(km/h) from 0 to 15 keep the GEAR in 1st GEAR.
  2. Speed Range(km/h) from 16 to 25 keep the GEAR in 2nd GEAR.
  3. Speed Range(km/h) from 26 to 40 keep the GEAR in 3rd GEAR.
  4. Speed Range(km/h) from 41 to 60 keep the GEAR in 4th GEAR.
  5. Speed Range(km/h) from above 60 keep the GEAR in 5th GEAR.

STATEFLOW LOGIC IMPLEMENTATION:

Stateflow logic is implemented by chart block, in chart block we can create the continuous and discontinuous control logic system.

  1. The input value is in the range of 0 to above 60. The input value is nothing but the speed (Km/H).
  2. Stateflow is implementing the control logic for GEAR SHIFT. G1, G2, G3, G4, G5 which are output signals.
  3. In between the conditions,
    1. Speed Range(km/h) from 0 to 15 keep the GEAR in 1st GEAR.
    2. Speed Range(km/h) from 16 to 25 keep the GEAR in 2nd GEAR.
    3. Speed Range(km/h) from 26 to 40 keep the GEAR in 3rd GEAR.
    4. Speed Range(km/h) from 41 to 60 keep the GEAR in 4th GEAR.
    5. Speed Range(km/h) from above 60 keep the GEAR in 5th GEAR.
  4. To get the 1st gear G1 we need to give the condition-1 [input>=0] and condition-2 [ input<0], if it is satisfied the condition-1 then the GEAR is at position 1, and the condition-2 is satisfied then the GEAR is SHIFTED. Which is G1 = 1 for condition 1 and G1 = 0 for condition 2
  5. To get the 1st gear G2 we need to give the condition-1 [input>15] and condition-2 [ input<=15], if it is satisfied the condition-1 then the GEAR is at position 2, and the condition-2 is satisfied then the GEAR is SHIFTED. Which is G2 = 1 for condition 1 and G2 = 0 for condition 2
  6. To get the 1st gear G3 we need to give the condition-1 [input>25] and condition-2 [ input<=25], if it is satisfied the condition-1 then the GEAR is at position 3, and the condition-2 is satisfied then the GEAR is SHIFTED. Which is G3 = 1 for condition 1 and G3 = 0 for condition 2
  7. To get the 1st gear G4 we need to give the condition-1 [input>40] and condition-2 [ input<=40], if it is satisfied the condition-1 then the GEAR is at position 4, and the condition-2 is satisfied then the GEAR is SHIFTED. Which is G4 = 1 for condition 1 and G4 = 0 for condition 2
  8. To get the 1st gear G5 we need to give the condition-1 [input>60] and condition-2 [ input<=60], if it is satisfied the condition-1 then the GEAR is at position 5, and the condition-2 is satisfied then the GEAR is SHIFTED. Which is G5 = 1 for condition 1 and G5 = 0 for condition 2

Here the Stateflow control logic is a continuous system. until we give to stop the logic carried out from engine start to engine stop.

SIMULINK BLOCK DIAGRAM:

SIMULINK EXPLANATION:

  1. As input, we have taken the slider block which has a speed range from 0 to 80.
  2. The main aim of this control logic is to change the GEAR with varying speed limits.
  3. If the value of speed is 40 then it has to be at gear no 4 which is G4.
  4. Let us consider the outputs G1, G2, G3, G4, G5.
  5. When the speed is from 0 to 15 it's in G1 when the speed increases to 25 it's in G2.
  6. similarly, when the highest speed 65 is carried out then the gear at G5, when the sudden drop occurs at speed 20 it's in G2.
  7. The gear shift occurs at increasing speed range or decreasing speed range.
  8. The speed range of each gear can be seen in SPEEDO GAUGE, by a color indicator.

SIMULINK BLOCK DIAGRAM OUTPUT IN GUI (GRAPHICAL USER INTERFACE):

RESULTS:

1. IMPLEMENT CONTROL LOGIC OF A "WASHING MACHINE" USING STATEFLOW. THE STATEFLOW CONTROL LOGIC IS A DISCONTINUOUS SYSTEM LOGIC WHICH IS A SINGLE CYCLE SYSTEM PROCESS. WERE IT HAS TO START AND STOP PROCESS

2. IMPLEMENT CONTROL LOGIC OF A "GEAR SHIFT" USING STATEFLOW. THE STATEFLOW CONTROL LOGIC IS A CONTINUOUS SYSTEM. UNTIL WE GIVE THE STOP COMMAND, THE LOGIC WILL CARRIED THROUGHOUT THE PROCESS FROM ENGINE START TO ENGINE STOP AND N NUMBER OF GEAR SHIFT BEEN TAKEN IN A SINGLE CYCLE SYSTEM.

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.