Challenge

Week - 4

AIM:-

  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

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.

PART 1-Implement control logic of a “washing machine” using Stateflow.

Following things we need for modeling the subs system of washing machine logical block settings:

1. Toggle switch

2. Constant

3. State flow chart

4. Lamps

5. Display

CONDITION FOR WASHING MACHINE-

  • Soaking- 200sec(0-200sec)
  • Washing- 100sec(200-300sec)
  • Rinsing- 20sec(300-320sec)
  • Drying/Spinning- 50sec(320-370sec)
  • Completed/ Stop the machine

STATE FLOW LOGIC CHART-

EXPLANATION OF CHART-

  • First, we have created power state and after input going from the power state, we have applied one condition '[power==1]' means if power supply is on, it goes to second state (ON state). If there is no power detected, means it goes through condition '[power==0]', and it further goes to OFF state condition.
  • When power is detected, second state(ON state) got activated and it goes to third state i.e. 'water_supply'. After going through the third state(water_supply), it goes through water condition. That means, if '[water==1]' condition satisfied, then it goes to soaking state for soaking operation for 200 sec. If [water==0] condition got satisfied, then it goes to OFF mode where machine stopped and stop lamp got activated.
  • When soaking operation done for 200 sec, it got shifted to washing state and washing is done for 100 sec. After washing state, it goes to rinsing state for 20 sec where rinsing operation works After rinsing state got completed, it goes to drying/spinning state for 50 sec where spinning/drying process works for drying the clothes.After drying / spinning state got completed, then machine goes to OFF state confirming it has follwed all the washing steps and washing got completed for clothes and machine got stopped.

SIMULINK MODEL-

EXPLANATION-

  • Power and Water supply given to the Washing machine are dependent upon the toggle switch conditions which is on or off and it is defined by the constant value 0 or 1. The signal is then given to above state flow logic. If the value displayed is 1 for the power and water supply block then water and power supply will be given to Washing machine.
  • If value is 0 and 1 for water and power supply respectively, then the machine will start however, the machine won't execute any washing process as one of the switches are off. It means that machine detects that water supply is not available and goes to OFF state to turn OFF the machine. Also, if the value is 1 and 0 for water and power supplt respectively, then the machine will not even start because of no power input was provided.
  • When both power and water supply are at 1 then the soaking process starts and run for 200 sec, after this washing process will start and it lasts for further 100 sec.
  • Thereafter, the rinsing process starts and lasts for 20 sec. Thereafter, the drying process is started for 50 sec which the water supply is cut off and drying of clothes will execute.
  • After completing all the washing tasks, the washing machine goes to OFF state indicating that all tasks completed and turns off the machine and stop lamp got activated.
  • For all the different process or states of the machine, the lamp indicates green for working and red for not working. However, for stop process (OFF state) we have given red color as true condition. So, that when machine goes to OFF state. This all gives a better idea to user, now which process is going on in the Washing machine.

Now following with steps involves in the process we go step by step:

  • Water supply OFF & Power supply OFF
  • Power ON,Water supply OFF
  • Water supply ON & Power supply OFF

  • Water supply ON, Power supply ON

PART 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.

THEORY-

Internal-combustion engines run at high speeds, so a reduction in gearing is necessary to transmit power to the drive wheels, which turn much more slowly.The gearbox provides a selection of gears for different driving conditions: standing start, climbing a hill, or cruising on level surfaces. The lower the gear, the slower the road wheels turn in relation to the engine speed.The gearbox is the second stage in the transmission system, after the clutch . It is usually bolted to the rear of the engine , with the clutch between them.

Modern cars with manual transmissions have four or five forward speeds and one reverse, as well as a neutral position.

The gear lever , operated by the driver, is connected to a series of selector rods in the top or side of the gearbox. The selector rods lie parallel with shafts carrying the gears.The most popular design is the constant-mesh gearbox. It has three shafts: the input shaft , the layshaft and the mainshaft, which run in bearings in the gearbox casing.There is also a shaft on which the reverse-gear idler pinion rotates.

The engine drives the input shaft, which drives the layshaft. The layshaft rotates the gears on the mainshaft, but these rotate freely until they are locked by means of the synchromesh device, which is splined to the shaft.It is the synchromesh device which is actually operated by the driver, through a selector rod with a fork on it which moves the synchromesh to engage the gear.The baulk ring, a delaying device in the synchromesh, is the final refinement in the modern gearbox. It prevents engagement of a gear until the shaft speeds are synchronised.On some cars an additional gear, called overdrive , is fitted. It is higher than top gear and so gives economic driving at cruising speeds.

BLOCK USED TO GENERATE MODEL-

  • Slider - The Slider block tunes the value of the connected block parameter during simulation
  • Constant Block - Constant/fixed inputs provided to the stateflow chart.
  • Display - We have used the display block to show the vehicle is going at which gear for particular speed.
  • Real-Time Synchronization Block :- This block uses to synchronize model execution to real time in normal mode
  • Scope :- This block is used to visualize output waveform
  • Gauge- This block is used so that it can deflect gear number according to the display block's output.

STATE FLOW CHART-

EXPLANATION-

  • Initially, we have created first state(Gear_1) and in this, we have given a condition such that if input speed>15 then the gear got shifted to second gear. That means, if (speed<=15) condition satisfied then the car remains in the first gear only.
  • When the (speed>15 condition) got satisfied then the car got shifted to second gear(Gear_2 state). Then the car remains in the second gear until speed goes above 25 unit.
  • When (speed>25 condition) got satisfied then the car shifted to third state(Gear_3). Further, if speed falls to 25 and below 25 unit, the car got again shifted to second gear
  • Furthermore, if (speed>40 condition) got satisfied then the car shifted to fourth state(Gear_4). Further, if speed falls to 40 and below 40 unit, the car got again shifted to third gear
  • Also,if (speed>60 condition) got satisfied then the car shifted to fifth state(Gear_5). Further, if speed falls to 60 and below 60 unit, the car got again shifted to fourth gear.
  • If the speed remains to be higher/greater than 60 unit then the car will remain in fifth gear only untill there is any drop in speed of the car.

SIMULINK MODEL-

EXPLANATION-

  • Initially, we have taken Slider block so that we can vary our speed input during simulation. Instead of using simulation time as infinite time, we have used real-time kernel block i.e. Real-Time synchronization.
  • We have connected the slider block to the constant block(speed) and that block is further connected to contol logic so that gear shifting of car can be achieved by varying the speed input.
  • Hence, when we increase the speed by moving the slider then automatically as per our control logic and given condition, the corresponding gear number was displayed at the output. We have used display block at the output of control logic chart to record the gear number for particular instance of speed
  • Further, we have also used vertical gauge block and renamed as gear shifting indicator. We have internally connected that Gear shifting indicator block to display block so that gear number can be correspondingly deflected.
  • Also, we have used scope block to visualise the output(i.e. Gear number & input i.e. Speed).

1st GEAR-

2ND GEAR-

3RD GEAR-

4TH GEAR-

5TH GEAR-

OUTPUT-

Conclusion- From the above graph,It is that Gear shifting of the car took place as per given speed 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.