Challenge

Week - 4

WEEK 4 CHALLENGE

  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

ANS:

HERE THE BASIC BLOCKS USED ARE CHART, CONSTANT, DISPLAY, LAMP & ROCKER SWITCH
All blocks are taken from the library browser

Model of Simulink showing the block diagram of washing machine

From the above diagram the power and water are the inputs.
The outputs are washing state, drying, rinsing, soaking and END.
In the chart block we have given the logic for washing machine
The rocker switch from the library is connected with the constant block to provide the inputs parameters such as power and water supply, if the rocker switch is in ON position the constant value = 1 or if the rocker switch is in OFF position constant value = 0
The lamps are connected to the output blocks(Display) to indicate the statutes off the machine whether it is running in which mode such as washing, soaking and drying
Timing for each state is given as per the input instructions, the statutes of each state is shown the ouput block(display) and this display block is connected to the lamp
If the lamp is in red colour the output = 0 or if the lamp indicates green colour the output = 1
If the lamp is glowing is green colour it indicates the current state is in active mode

In the above chart block we have given logic for the washing machine

First state has 2 conditions, 1st is power and 2nd is water if the power==1&water==1 the washing machine gets activated and starts the processes and other operations are as shown in above figure such as
These 4 operations are in flow order of their respective timing
Soaking
Washing
Rinsing
Drying
The time for above state is given as per the input data and same logic is implemented in the flowchart (chart block)
200 seconds for Soaking
100 Seconds for Washing
20 Seconds for Rinsing
50 Seconds for Drying
Entry is kept as 0 and exit is kept as 1 when process is completed in each state it is 1
for example in above Simulink model is running at soaking state the output will show in the dispay as 1 and lamp glows in green colour for every state of operation it indicates with lamps and display as 1 same process will continue for every state.
When total process is completed in washing machine all LEDs will glow


SYMBOL PANE:

In above symbols pane water and power are considered as inputs
Washing
Soaking
Rinsing
Drying
END are considered as outputs
In below Simulink model red light indicates that mode of operation is not completed and it is in process green light indicates that mode of operation is completed

Model showing that washing machine is at Rinsing state

Model showing that washing machine is at drying state:

Model showing that washing machine completes all state of operations

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.

ANS:

Simulink model for gear shift logic as per above conditions

HERE THE BASIC BLOCKS USED ARE CHART, CONSTANT, DISPLAY, LAMP, SLIDER & ROCKER SWITCH

in this model all the blocks are taken from the simulink library browser

From the above diagram the power and Throttle are the inputs.
The outputs are first gear, second gear, third gear, fourth gear and fifth gear.
In the chart block we have given the logic for Gear shift
Logic for gear shift

Slider block from the library browser is used as throttle in this slider block we have to give the minimum and maximum speed limits i.e. from 0 to 1

Throttle is input and it is used as the accelerator with the help of this throttle pedal we can change the value of vehicle speed
Here engine is at OFF position at starting state when the power is ON the engine gets activated
Entry condition for First gear is speed should be >=0 and exit conditions is when the speed
is >15
Entry condition for second gear is speed should be >=16 and exit conditions are when the speed
is >25 and <=15.
Entry condition for third gear is speed should be >=26 and exit conditions are when the speed
is >40 and <=25.
Entry condition for fourth gear is speed should be >=41 and exit conditions are when the speed is >60 and <=40.
Entry condition for fifth gear is speed should be >=61 and exit conditions are when the speed is <60.
Here lamps are connected to each gear so whenever vechile runs at specified certian gear that the lamp glows according to the state of gear similarly display is also connected to each gear when ever vehicle is running at certian gear that gear output display value shows as 1 if gear is not active display shows as 0

vechicle running at 1st GEAR the speed is below 15kmph

vechicle running at 2nd GEAR the speed is above 15kmph and below 26 kmph

vechicle running at 3rd GEAR the speed is above 25kmph and below 41 kmph

vechicle running at 4th GEAR the speed is above 40kmph and below 61 kmph

vechicle running at 5th GEAR the speed is above 61kmph

Conclusion: As per above requirments the logics for washing machine and gear shift were implemented and display outputs and lamps were glown

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.