1 / 10

State Transition Diagrams

State Transition Diagrams. 3.3.1. This presentation covers. What is a State Transition Diagram? Wh y are they used ? How to draw them. Introduction. A system can be defined at any one point as being in a particular state...

marcos
Download Presentation

State Transition Diagrams

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. State Transition Diagrams 3.3.1

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

  3. Introduction • 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. Door Example • There are only two states for a door...open or closed. • The transitions are opening or closing. Door Opening Door Closed Door Open Door Closing

  5. State Transition Diagrams • 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 Opening Door Closed Door Open

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

  7. Filling up a water bottle • 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. B3: Not full 1. Empty 2. Check bottle B1: Squirt (n) IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3

  8. Filling up a water bottle • 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. B3: Not full 1. Empty 2. Check bottle 3. Full B1: Squirt (n) B2: Full IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B4: Screw on cap 4. Sealed

  9. Filling up a water bottle • 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. 5. Broken B5: Break B3: Not full B5: Break 1. Empty 2. Check bottle 3. Full B1: Squirt (n) B2: Full IF (content + n) >= capacity THEN Go to B2 ELSE Go to B3 B4: Screw on cap 4. Sealed

  10. Your turn to give it a go! • 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... 1. Empty

More Related