igstk

Comments

Transcription

igstk
IGSTK
State Machines
Luis Ibáñez
Kitware, Inc
Why the State Machine ?
Image Guided Surgery is a critical task
Software must protect patient from harm
by enforcing:





Deterministic Behaviour
Preclude wrong use
Robustness to misuse
Traceability
Documentation
Background
Introduced in 1936 by Alan Turing
Minimal description of an Algorithm
Introduced for the study of
Effective Computation
State Machine
State 1
State 2
State 3
….
State N
Input 1
Input 2
Input 3
….
Input M
State Machine
State K
Action 1
Action 2
Action 3
….
Action K
(State 1,Input 1)->(State 7, Action 4)
(State 1,Input 2)->(State 3, Action 2)
(State 1,Input 3)->(State 5, Action 6)
(State 2,Input 1)->(State 4, Action 9)
(State 3,Input 4)->(State 9, Action 2)
State Machine

Set of States

Set of Inputs

Set of Actions

Set of Transitions
UML State Machine

Improvements over Mealy-Moore FSM

States
– Nested States (hierarchical states)
– And-States (independency / concurrency)
– Pseudo-States (annotation)
UML State Machine

Improvements over Mealy-Moore FSM

Events
– Signal Event
asynchronously sent
– Call Event
synchronously sent
– Time Event
passage of time interval
– Change Event
change in state variable
State Machine Diagram
Input 4
Action 5
Action 7
Input 3
State 1
Input 2
Action 1
Input 2
State 0
Input 4
Action 3
State 2
Input 3
Input 7
Action 2
State 3
Action 9
Action 1
State Machine Integration
IGSTK Component
State Machine<>
public:
RequestAction1()
RequestAction2()
private:
PerformAction1()
PerformAction2()
State Machine Integration
RequestAction3()
ProcessInput()
PushInput(“Input3”)
Input Queue
State Machine<>
Input 3
State A
State B
PerformAction3()
State Machine Integration
IGSTK Component
public:
private:
RequestAction1()
PerformAction1()
RequestAction2()
PerformAction2()
RequestAction3()
PerformAction3()
RequestAction4()
PerformAction4()
Request Action Methods
Request Action( argument list )
ArgumentValidation()
( Input categories )
Input 4
State Machine
ProcessInput()
B
C
PerformAction4()
A
D
Request Action Methods
RequestSelectSlice( int N )
ArgumentValidation()
State Machine
ProcessInput()
RequestSetSlice(int)
( slice < 0 ) : Input0 : (out of range)
( slice > N-1) : Input2 : (out of range)
Otherwise : Input1 : (valid value)
RejectSliceNumber()
AcceptSliceNumber()
B
B
B
Examples of IGSTK
State Machine Diagrams
Tracker Base Class
Pulse Generator
Spatial Object
Using the State Machine
State Machine Integration
StateMachine1
StateMachine2
Signal Event
Timer Event
Signal Success Event
Signal Loaded Event
Signal Error Event
Timer Event
IGSTK

Similar documents