Challenge

Week - 4

1. control logic of a “washing machine” using Stateflow:

Power and water supplies are represented by slider switch blocks linked to constant block for multiplying.

Indicators for the same are represented by two lamp blocks which turn green when the condition is met.

Going under the mask of Washing Machine Chart, The following state flow blocks are programmed:

The default is set to power state which when ON, proceeds on to Water State, which, when ON, Subsequently executes the consequtive states with time delays mentioned in the conditions over the arrow marks.

As each state executes the internal values of a,b,c,d of Soaking, Washing, Rinsing and drying states respectively are changed to 1 from intial value of 0. X represents the completion state just to mark the end of process.

The same are taken as output variables whereas the pow and wat are taken as input variables via the symbols pane to the right as can be seen in the above picture.

Step1

Step 2

Step 3

Step 4

Similarly till step7

Case1: If water supply is turned off:

As one can see, the power state is executed but then

The path [wat==0] has been chosen and further the simulation stops without executing the further states. Hence acts like an inter lock

2.

GEAR SHIFT Logic

Speed Range(kmph) Gear

0 to 15 1

16 to 25 2

26 to 40 3

41 to 60 4

Above 61 5

Chart

Symbol pane

The lamps are connected to the same variable, Gear which turns green when the corresponding value is 0,1,2,3,4 or 5. As shown in pic

A slider gain is used to simulate the variation in the velocity of the vehicle. Which is linked with the multiplier constant block.

vel is used as an input variable and gear is used as an output variable

When vel is put at 0 using the knob in slider gain block the following result observed

When slider gain is put in somewhere around 67 the following is observed

When vel is set to 32

Hence the gear indicator lights to green corresponding to the velocity of the vehicle which can also be seen in the display block named Gear.

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.