Presentation is loading. Please wait.

Presentation is loading. Please wait.

3.3.1. What is a State Transition Diagram? Why are they used? How to draw them.

Similar presentations


Presentation on theme: "3.3.1. What is a State Transition Diagram? Why are they used? How to draw them."— Presentation transcript:

1 3.3.1

2 What is a State Transition Diagram? Why are they used? How to draw them.

3 A system can be defined at any one point as being in a particular state... Whether it is ready to receive an input or processing data ready for it to be output. State Transition Diagrams (STD) basically map out the state of a system in diagram form. This type of diagram essentially describes the behaviour of the system.

4 There are only two states for a door...open or closed. The transitions are opening or closing. Door Closed Door Open Door Closing Door Opening

5 States are shown as locations. Transitions are represented by arrows. – These are the reasons why the state is changing. – For example... The state changes because the door is opening. Door Closed Door Open Door Opening

6 An input may have different effects on a state. Multiple transitions can result from the same state (as in this diagram). 1. Empty 4. Sealed 2. Check bottle 3. Full 5. Broken B1: Squirt (n) IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B3: Not full B2: Full B4: Screw on cap B5: Break

7 First of all we have to squirt water into the bottle at a quantity of n. We then check the bottle to see if it is full. If it isn’t full we go through the transition of B3: Not full as the state is still considered to be Empty. 1. Empty 2. Check bottle B1: Squirt (n) IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B3: Not full

8 When we have reached a full state then we can place the cap on the bottle. The transition is B4: Screwing on a cap. We then arrive at a state of Sealed. 1. Empty 4. Sealed 2. Check bottle 3. Full B1: Squirt (n) IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B3: Not full B2: Full B4: Screw on cap

9 The state Broken is reached if the bottle breaks. If the bottle was full at point 2 and then isn’t at state full you can assume the bottle is broken. 1. Empty 4. Sealed 2. Check bottle 3. Full 5. Broken B1: Squirt (n) IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B3: Not full B2: Full B4: Screw on cap B5: Break

10 Try drawing an STD which covers the following states: – Filling up a kettle – Boiling the water – Pouring the water into mugs (note: do not worry about the mugs...I am more concerned with the state of the kettle). – This is the first state Empty


Download ppt "3.3.1. What is a State Transition Diagram? Why are they used? How to draw them."

Similar presentations


Ads by Google