Challenge

Week - 4

1. Washing Machine Control logic:

  • In the Control logic in State flow, the states are activated only when Power == 1 and the Water supply == 1. This ensures that the machine is not started without the power supply and water. (Refer attachment: Washing machine_Stateflow.jpg) 
  • If the water supply is not available, the LED indicator is turned ON (Set to RED) in the 'exit' action in the Initialize state.
  • Switch from Soaking time to Washing time is set by the transition command (after (200, sec))
  • Similarly Washing to Rinsing state transition is set as after (100,sec), Rinsing to Drying state transition as after (20, sec), Drying to Finish state transition as after (50,sec). 
  • After completion of washing, the Finish_wash is set to TRUE and accordingly the Finish washing LED is turned ON (Set to GREEN). (Refer attachment: Washing machine_Block diagram.jpg)

_______________________________________________________________________________________

2. Gear shift logic:

  • In the control logic in State flow, Start state is initialized that if the Speed==0, then the engine is considered to be stopped. Hence engine_stopped is initialized to TRUE. LED indicator glows RED. (Refer attachment: Gear Shift_Block diagram.jpg)
  • Once the Speed is increased via the Slider, transition from Start state to 1st gear state happens. This is checked using the transition condition (Speed>0 && Speed <=15). Similarly it is considered for the transition from
    • 1st gear to 2nd gear as (Speed>=16 && Speed <=25)
    • 2nd gear to 3rd gear as (Speed>=26 && Speed <=40)
    • 3rd gear to 4th gear as (Speed>=41 && Speed <= 60)
    • 4th gear to 5th gear as (Speed>61)
  • Once the Speed is decreased via the Slider, the reverse happens i.e the current gear should be reduced to the low speed gear (i.e 1 step gear reduction). For this the below logic is used
    • From 5th gear if the speed reduces, (Speed<61) tranisition condition will cause the transition to 4th gear state
    • Similarly, from 4th gear to 3rd gear (Speed<41)
    • For 3rd gear to 2nd gear (Speed<26)
    • For 2nd gear to 1st gear (Speed<16). (Refer attachment: Gear Shift_Stateflow.jpg)
  • Gear number is changed along with the increasing and decreasing gear transition state. Current gear number is displayed in the 'Display' dashboard.
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.