Challenge

Week - 4

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

Stateflow Chart:

  • 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 you to design and develop supervisory control, task scheduling, fault management, communication protocols, user interfaces, and hybrid systems.

  • With Stateflow, you 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.

  • Matlab uses a graphical representation instead of writing code for a flow chart/state transition.And we have an option to generate a code form the graphical model.

States and Transition condition for Washing machine:

Washing machine is used to wash our cloths.It performs different actions to clean our cloths.Each action is considered as state.

  • Water Filling is filling the drum with water along the the washing detergent.For fillling the water a small pump is used.
  • Soaking is used to dip clothes in detergent water for a predefined time either by manually/automatically to remove dirt from the clothes.
  • Washing state is to remove the dirt from the cloth by repeated clockwise and anticlockwise direction.This action is performed with the help of motors.In this case the water may be change for very less times.
  • Rinsing state is repetedly washing the cloth with the fresh water every time.
  • Drying is to remove the water from the cloth by spinning the drum at high rpm and in somecase a heat blower is also used for drying.

Conditions:

  • 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

Modelling:

  • It need two input signals Power_Supply and Water_Supply signals.These are modelled with the help of Slider switch and constant block.
  • The States are Start,Power_Supply,Water,Soaking,Washing,Rinsing,Drying and Stop state each state has entry and exit conditions and these conditions are setting the status signl for each state.
  • The Lamp block is used to indicate the State transition from one to another and overall model looks like
  • Green indicates the ON state and Bulue/Red indicates OFF state.

Result:

Power_Supply On indicated by green light

Water supply OFF indicated by red light followed by available by green light.

Soaking:

  • Likewise the remaining state transition happen as per given transition condition.

2.Make a Simulink chart for the “Gear shift” logic as per below conditions:

Inputs:

  • The vehicle speed is the input to state logic.These input is modelled with the help of slider and conatant blocks.
  • The states are Neutral,Gearshift1 to Gearshift5 by following condition

    Speed Range(kmph) Gear

    0 to 15 1

    16 to 25 2

    26 to 40 3

    41 to 60 4

    Above 61 5

  • The output signal is Gear position which is displayed with the help of display block.

Modelling:

Note:

  • This system is modelled in a way that the gear shift occurs in a linear ie inorder to reach 3rd gear,it starts from Neutral,1st,2nd gear and then 3rd gear.
  • This is modelled as enabled subsystem when engine is on this subsystem works otherwise shows the previous state.

Result:

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.