Challenge

Week - 4

Aim:-
1. To implement control logic of a "washing machine using Stateflow as per given sequence 2. Make a Simulink chart for the "Gear shift" logic.
Introduction:-
State Flow- State Flow is a technique to convert a flow-chart or logic into a systematical arrangement. 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.
State Machine- Model of systems whose behavior can be modeled as a set of states and transitions between states. These systems are sometimes called reactive systems.
A finite state machine is a representation of an event-driven (reactive) system. In an event-driven system, the system responds to an event by making a transition from one state (mode) to another. This transition occurs if the condition defining the change is true.
A Stateflow chart is a graphical representation of a finite state machine. States and transitions form the basic elements of the system. You can also represent stateless flow charts.
States- Stages include used in a system, or operating modes of the system

#Part-1:- control logic of a "washing machine"

Objective:-Using the control logic of a "washing machine in a 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 the next 20s & dryer runs for 50s
After all the processes have completed turn on the finished LED


Procedure:-States of Washing Machine includes-After providing the electric supply and Check for the water availability... 1. Soaking- Soaking the clothes into the water for 200 seconds as per the requirement.

2. Washing- Motor runs forward and backward direction to wash the clothes 100 seconds.

3. Rinsing- Draining of water from the washing machine for 20 seconds.

4. Drying- After Draining of water, a Dryer is used for 50 seconds to dry the clothes.

For the above processes, I am using the State Flow chart method,

- As per the requirement, I am using two inputs, one is Power supply and the other is Water supply to check the given condition.

- I use 2 slider switch to switch on/off the power & water supply and connect to the constant block to provide the conditions to the washing machine by toggling the switches

- In the state flow chart, we first apply the condition for the Motor_on by putting 'power==1* we check the power supply here, if it is off then the process is terminated if it is on then it moves to the other process.

- In the next process, I made a logic to check the water availability, if there is no water condition[waterna it shuts the process by reaching the termination block, and if the water is available[water==1], it proceeds to the other processes.

- After fulfilling the condition of water supply, all the process proceeds one by one with given time delays, for time delay, I use after() command/condition. For Soaking(200 sec), Washing(100 sec), Rinsing(20 sec) & drying(50 sec).

- After completing all the stages, it goes to the termination block. - The logic is made in such a way that if there is any false input condition provided, it shuts the process and terminates the system.

SIMULINK:-

1) WHEN POWER SUPPLY AND WATER SUPPLY IS OFF.

2) WHEN ONLY POWER IS ONN

3) WHEN BOTH POWER AND WATER SUPPLY IS ONN

STATE-FLOW CHART

#Part:-2- Make a Simulink chart for the "Gear shift" logic.

objective.- 1. Make a Simulink chart for the "Gear shift" logic as per below conditions:
Speed Range(km/h) Gear

O to 32 1

33 to 64 2

65 to 96 3

97 to 128 4

129 to 160 5

160 to 170 6

2. Give speed input while the simulation is running & display the gear number.
Procedure:-

-In this Gear shifting case, we need to provide a continuous variable value for the input as a speed, for that, I use a Slider block as an accelerator for the speed change.

-As per our Requirement, we need to display the gear number to be visible on the Display block at the time of acceleration, so I use infinite time(inf) for compilation and change the speed manually on the Slider block.

- I configure the slider block by providing the values min=0 max=170, as the speed of the vehicle

- Same values I configure to the Gauge block (speedometer), to show the input.

- I use Lamp block to show if the system is on or off and for the Overspeed.

SLIDER BLOCK PARAMETER

GUAGE BLOCK PARAMETER

- Both Slider Block & Gauge Block is connected to the input (accelerator), slider block will be used to determine the speed and the Gauge block displays the speed

- I used the Toggle Switch block to connected to the input to on/off the system.

- As per the requirement, the gear number should be visible as the speed changes, for that I used Different lamps to indicate the gear as the result.

-Here I use the condition as, if there is supply==0, it follows the condition is true and it flows the circuit to Engine off

Simulink Model when the system is OFF-

-Here I use the condition as, if there is suplly==0, it follows the condition is true and it flows the circuit to Engine off

Simulink Model when the system is ON - Here I use the condition as, if there is suplly==1, it follows the condition is true and it flows the circuit to Engine ON - Green lamp is pop up when is system is ON

State Flow Chart or the logic used in the system

- In State Flow Chat the logic I used - As per the requirement, after providing the supply, I provide the condition as if the speed is greater than and equal to a particular speed it will change the gear block, so on increasing/ decreasing the speed as an input, it proceeds to the next stage.

Shifting Gears--I put the run time to infinite(inf), we can change the speed while the simulation is running, On putting the engine condition ON, we change the speed limit on the slider block. as pe given speed range

Speed Range(km/h) Gear

O to 32 1

33 to 64 2

65 to 96 3

97 to 128 4

129 to 160 5

160 to 170 6

- To provide the above condition and get the gears as result, the speed should lie in between the range for the particular gear. - On Sliding the Slide bar(for increasing/decreasing the speed), below are the output we get.

1) gear 2 of Speed Range(km/h) 33 to 64

2) gear 3 of Speed Range(km/h) 65 to 96

3) gear 4 of Speed Range(km/h) 97 to 128

4) gear 5 of Speed Range(km/h) 129 to 160

5) gear 6 of Speed Range(km/h) 160 to 170 (OVERSPEED)

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.