Lecture 21-22 State Transition Diagram
Lecture 21-22 State Transition Diagram
This modeling technique came from a more formal area called automata theory.
State transition diagram depicted a Finite State Machine.
Software Program View
turnOn
turnOff
turnOff turnOff
on off
on off
2. Even with a modest number of states and events, the state transition
diagram, which really depicts the transition rules, can be enormous.
State Diagrams
• State diagrams are used to show possible states a
single object can get into
– shows states of an object
Tracking
entry action
entry / setMode(on Track)
exit action exit / setMode(off Track)
internal transition Tracking / tracker.Acquire()
newTarget/tracker.ChangeTrack()
external transition
do / followTarget
activity
getFirstItem
getNextItem Checking
[not all items checked]
do / checkItem
cancelled
itemsReceived
[some items not in stock]
cancelled
Waiting Delivered
cancelled
Cancelled
Types of State Machine Diagram
Anti-Aircraft (AA)
Gun
Advanced State Machine Modeling
• Nested states
• Concurrent states
Nested State Machine- Telephone
Nested State Machine- Printer
Activity diagram is a fancy flow chart which shows the flow of activity of
a process.
max 3 times
logging in selecting item category requesting item getting item info placing the order
logged
on failure
DigitalWatch
A
Set hours
do / show hours A
A
Display time Set minutes
B / advance hour
do / show hours and do / show minutes
minutes
B / advance minute
Problem # 2
• A separate appliance control determines when the motor should be on and
continuously asserts on as an input to the motor control when the motor
should be running.
• When on is asserted, the motor control should start and run the motor.
• The motor starts by applying power to both the start and the run windings.
A sensor, called a starting relay, determines when the motor has started, at
which point the start winding is turned off, leaving only the run winding
powered. Both winding are shut off when on is not asserted.
• Appliance motors could be damaged by overheating if they are overloaded
or fail to start. To protect against thermal damage, the motor control often
includes an over-temperature sensor. If the motor becomes too hot, the
motor control removes power from both windings and ignores any on
assertion until a reset button is pressed and the motor has cooled off.
• Add the following to the diagram.
– Activities: apply power to run winding, apply power to start winding.
– Events: motor is overheated, on is asserted, on is no longer asserted, motor is running, reset.
– Condition: motor is not overheated.
MotorControl
Too hot