SlideShare a Scribd company logo
State Modeling
Introduction
• The structure of objects and their relationships to each other in
a system described by its static structure i.e. the class model.
• Some objects in a system have complex temporal behaviors,
which must be carefully design.
• Temporal phenomena that occur over an interval of time are
properly modeled with a state
• The state model examine changes to the objects and their
relationships over time
• The state model describes the sequence of operations that
occur in response to events (external stimuli)
Events
• occurrence at a point in time
– instantaneous
– often corresponds to verb in past tense
• e.g., alarm set, powered on
– or onset of a condition
• e.g., paper tray becomes empty, temperature drops below freezing
• may logically precede or follow another or may
be unrelated
– e.g., Flight 123 must depart DDN before it can arrive in Delhi
(causally related)
– e.g., Flight 123 may depart before or after flight 345 departs DDN
(causally unrelated)
• Concurrent event: causally unrelated events;
have no effect on one another
Kinds of events
Signal event:
– the event of sending or receiving of a signal
• Signal: an explicit one-way transmission of
information from one object to another
• may be parameterized
– E.g., stringEntered(“Foo”)
– sending of a signal by one object is a distinct
event from its reception by another
– Difference between signal and signal event
– every signal transmission is a unique
occurrence but we group them into signal
classes to indicate common structure and
behavior.
• E.g., IA flight 123 departs from DDN on Jan 11, 2013 is an
instance of FlightDeparture
Signal class - UML notation
<< signal >>
FlightDeparture
airline
flightNum
city
date
keyword “signal” in << >>
name of signal class
attributes
Kinds of Events
• Change event
– Event caused by satisfaction of a Boolean expression
– Intent: Expression continually tested; when changes from
false to true, the event happens
– UML Notation: keyword when followed by parenthesized
boolean expression
• when(room temperature < heating set point)
• when(room temperature > cooling set point)
• when(battery power < lower limit)
• when(tire pressure < minimum pressure)
Kinds of Events
• Time event
– Event caused by the occurrence of an absolute time or the
elapse of a time interval
– for absolute time the UML Notation: keyword when
followed by parenthesized expression involving time
• when (date = Jan 1, 2013)
– for time interval the UML Notation: keyword after followed
that evaluate to a timeby parenthesized expression
duration
• after (n timeUnits)
• after(10 seconds)
States
• an abstraction of values and links of an object
• behavioral condition that persists in time
• according to gross behavior of objects, set of values
and links are grouped together into a state
• often corresponds to
– verbs with suffix of “-ing”
• e.g., Boiling, Waiting, Dialing
– the duration of some condition
• e.g., Powered, BelowFreezing
• UML Notation: a rounded box containing an
optional state name
Powered Waiting Dialing
Contd.
• In defining states
– ignore attributes that do not affect the behavior of the object
– lump together in a single state all combinations of values and links
with the same response to events
– E.g., except for leading 0’s & 1’s, the exact digits dialed do not affect
the control of the phone line, so we can define a state Dialing and
track the phone number as a parameter
• Objects in a class have a finite number of possible states
– Each object can only be in one state at a time
– At a given moment of time, the various objects for a class can exist
in a multitude of states
• A state specifies the response of an object to input events
– E.g., if a digit is dialed in state DialTone, the phone line drops the
dial tone and enters state Dialing;
– If the receiver is replaced in state DialTone, the phone line goes
dead and enters state Idle.
Symmetry between Events and States
• Events represent points in time
• State represent intervals of time. A state
corresponds to the interval between two events
received by an object
Power turned on Power turned off Power turned on
Powered Not Powered
Transitions and Conditions
• Transition: an instantaneous change in state
– triggered by an event
– Transition is said to fire upon the change from source to target
state
– Origin and target state of a transition are different states but
may be the same
– e.g., when a phone line is answered, the phone line transitions
from the Ringing state to the Connected state.
• Guard Condition:
– boolean expression that must be true for transition to occur
– checked only once, at the time event occurs; transition fires if
true
– E.g., when you go out in the morning (event), if the temperature
is below freezing (condition), then put on your gloves (next
state).
State Diagrams
• a graph whose nodes are states and whose
directed arcs are transitions between states
• specifies state sequences caused by event
sequences
• all objects in a class execute the state diagram for
that class; diagram models their common
behavior
– Note: state names are unique within the scope of
state diagram
– A class with more than one state has important
temporal behavior
– A class is temporarily important if it has a single state
with multiple responses to events
State diagrams
S T
States
Graphical state-modeling notation:
– States: labeled rounded box
– Transitions: directed arcs, labeled by triggering event,
optional guard condition, and/or effects
Specifies the response of an object to input events
- ignores events except those for which behavior is
prescribed
Example:
Transition
State diagrams
Graphical state-modeling notation:
– States: labeled rounded box
– Transitions: directed arcs, labeled by triggering
event, optional guard condition, and/or effects
Example:
S T
event(attribs) [condition] / effect
States
EventTransition
• State diagrams can represent
– Continuous loops
• Do not care, how the loop is started
– One-shot life cycles
“One-shot” state diagrams
• represent objects with finite lives
– have initial and finite states
• initial state - entered on object creation
• final state - entry implies destruction of object
Example
Chess game
start state
black
moves
White’s
turn
Black’s
turn
white
moves
checkmate
stalemate
stalemate
checkmate Default final state
Example - entry and exit points
Chess game
White’s
checkmate
stalemate
stalemate
checkmate
turn
black white
moves moves
Black’s
turn
Black wins
Draw
White wins
State Model
• multiple state diagrams, one for each class
with important temporal behavior
– diagrams interact by passing events and through
side effects of guard conditions
– events and guard conditions must match across
diagrams in the model
Details
– if more than one transition leaves a state, then the
first event to occur causes the corresponding
transition to fire
– if an event occurs and no transition matches it,
the event is ignored
– if more than one transition matches an event, only
one transition will fire but the choice is non-
deterministic
State Diagram Behavior
Activity Effects
• effect = reference to a behavior executed in
response to an event
– can be attached to a transition or a state
– listed after a slash (“/”)
– multiple effects separated with a “,”and are
performed concurrently
Activity Effects
• Activity = behavior that can be invoked by any
number of effects
• May be performed upon:
– a transition
– entry to or exit from a state
– some event within a state
• Notation:
– event / resulting-activity
Activities
Often useful to specify an activity that is
performed within a given state
– E.g., while in PaperJam state, the warning light
should be flashing
– E.g., on entry into the Opening state, the motor
should be switched on
– E.g., upon exit of the Opening state, the motor
should be switched off
Activity effects
Idle Menu visible
r_button_down / showPopup
r_button_up / hidePopup
Do-Activities
• continue for an extended time
• can occur only within a state
• can not be attached to a transition
• include
• continuous operations, such as displaying a picture on a
television screen
• Sequential operations that terminate by themselves after an
interval of time
• may be performed for all or part of time that an object is in a state
•may be interrupted by event received during execution; event may
or may not cause state transition
PaperJam
do/ flash warning light
Entry and Exit Activities
Opening
entry / motor up
exit / motor off
• can bind activities to entry to/ exit from a state
•All transitions into a state perform the same activity, in
which case it is more concise to attach the activity to the state
Order of activities
1. activities on incoming transition
2. entry activities
3. do-activities
4. exit activities
5. activities on outgoing transition
Events that cause transitions out of the state can interrupt
do-activities. If a do-activity is interrupted, the exit
activity is still performed
• In general, any event can occur within a state
and cause an activity to be performed.
• Entry and exit are only two examples of events
that can occur
• Difference between an event within a state
and self-transition: only the self-transition
causes the entry and exit activities to be
executed but an event within a state does not
Completion Transition
• triggered by completion of activity in the source
state
• Often the sole purpose of a state is to perform a
sequential activity.
• When the activity is completed, a transition to
another state fires
• An arrow without an event name indicates an
automatic transition that fires
State 1
do / blah()
State 2
Contd.
• If a state has one or more completion transitions, but
none of the guard conditions are satisfied, then the state
remains active and may become ‘stuck’.
• The completion event does not occur a second time
• Therefore no completion transition will fire later to
change the state
• So if a state has completion transition leaving it, normally
guard condition should cover every possible outcome.
• Do not use guard condition on a completion transition to
model waiting for a change of value
Sending signals
• A object can perform the activity of sending a signal to
another object.
• A system of objects interact by exchanging signals
• The activity “send target.S(attributes)” sends a signal S with
the given attributes to the target object.
• E.g., the phone line sends a connect(phone number) signal to
the switcher when a complete phone number has been dialed.
• A signal can be directed to a set of objects or a single object.
• If the target is a set of objects, each of them receives a
separate copy of the signal concurrently and independently
process the signal and determines whether to fire a transition
or not
• If an object receive signals from more than one object, the
order in which concurrent signals are received may affect the
final state (race condition)
Advanced state modeling
• Conventional state diagrams are sufficient for
describing simple systems but need additional
power to handle large problems
• Model complex system by using
– Nested state diagrams
– Nested states
– Signal generalization
– Concurrency
Nested state diagram
• Problem with flat state diagram
– Consider an object with n independent Boolean attributes
that affect control
– representing such object with a single flat state diagram
would require 2n states
• Expanding state
– Organize the model by having high-level diagram with sub
diagrams expanding certain states
– Submachine: a state diagram that may be invoked as part
of another state diagram (lower-level state diagram).
– UML Notation for submachine: list a local name followed
by a colon and the submachine name.
Nested state
• Nest states to show their commonality and share
behavior
• Composite state: state that encloses the nested
states.
– Labels in the outer contour
• A nested state receives the outgoing transitions
of its composite states
Example: Transmission
Transmission
2nd 3rd
downshift
upshift
Forward
downshift
1st
upshift
stop
push N push F
Reverse
push N
push R
Neutral
Signal Generalization
• Organize signals into generalization hierarchy with
inheritance of signal attributes
• View every actual signal as a leaf on a generalization
tree of signals.
• Received signal triggers transitions that are defined
for any ancestor signal type.
– E.g., typing an ‘a’ would trigger a transition on signal
Alphanumeric as well as signal KeyboardCharacter.
• A signal hierarchy permits different levels of
abstraction to be used in a model.
– E.g., some state might handle all i/p characters the same;
other states might treat control characters differently
from printing characters .
CONCURRENCY
• State model supports concurrency among
objects
• Object can act & change state independent of
one another.
• Sometime objects shares constraints that
causes their state changes
AGGREGATION CONCURRENCY
• State Aggregation means collection of state
diagrams , one for each part
• “and” relationship
• Aggregate state is one state from first diagram &
a state from second diagram & state from each
other diagram.
• Transition for one object depend on another
object that allows interaction between the state
diagram.
Concurrency within an Object
• Some objects can be partitioned into subsets of
attributes or links.
• Each of the partitioned subset has its own subdiagram.
• The state of the object comprises one state from each
subdiagram.
• The sub diagrams need not be independent; the same
event can cause transitions in more than one
subdiagram
• UML Notation- partition the composite state into
regions with dotted lines.
Synchronization of Concurrent
Activities
• Sometimes one object must perform two ( or
more) activities concurrently.
• The object must complete both activities
before it can progress to its next state.
Fork and Join
OR
Splitting control and Merging control
• FORK- A transition that forks indicates splitting
of control into concurrent parts.
• JOIN- Explicit merging of concurrent control
by a transition.
Relation of class model, state model
• A state diagram describes all or part of the
behavior of the objects of a given class.
• States = classes of values & link for an object
• State model of a class is inherited by its
subclasses. Subclass inherits both the state &
Transitions.
• It is also possible to refine an inherited state
diagram by expanding state into nested state or
concurrent sub diagrams.
Contd.
• State structure is related to and constrained
by class structure.
– A composite state is the aggregation of more than
one concurrent substate.
– Try to make the state diagrams of subclasses
independent of the state diagrams of their
superclasses.

More Related Content

What's hot

Unit 1 static and dynamic
Unit 1 static and dynamicUnit 1 static and dynamic
Unit 1 static and dynamic
tamilnesaner
 
Lecture 12 time_domain_analysis_of_control_systems
Lecture 12 time_domain_analysis_of_control_systemsLecture 12 time_domain_analysis_of_control_systems
Lecture 12 time_domain_analysis_of_control_systems
Saifullah Memon
 
Generalized Stochastic Petri Nets
Generalized Stochastic Petri NetsGeneralized Stochastic Petri Nets
Generalized Stochastic Petri Nets
Umar Alharaky
 
6. steady state error
6. steady state error6. steady state error
6. steady state error
shurjeel amjad
 
Static &amp; dynamic characteristics of instruments
Static &amp; dynamic characteristics of instrumentsStatic &amp; dynamic characteristics of instruments
Static &amp; dynamic characteristics of instruments
kaavyabalachandran
 
Av 738-Adaptive Filters - Extended Kalman Filter
Av 738-Adaptive Filters - Extended Kalman FilterAv 738-Adaptive Filters - Extended Kalman Filter
Av 738-Adaptive Filters - Extended Kalman Filter
Dr. Bilal Siddiqui, C.Eng., MIMechE, FRAeS
 

What's hot (6)

Unit 1 static and dynamic
Unit 1 static and dynamicUnit 1 static and dynamic
Unit 1 static and dynamic
 
Lecture 12 time_domain_analysis_of_control_systems
Lecture 12 time_domain_analysis_of_control_systemsLecture 12 time_domain_analysis_of_control_systems
Lecture 12 time_domain_analysis_of_control_systems
 
Generalized Stochastic Petri Nets
Generalized Stochastic Petri NetsGeneralized Stochastic Petri Nets
Generalized Stochastic Petri Nets
 
6. steady state error
6. steady state error6. steady state error
6. steady state error
 
Static &amp; dynamic characteristics of instruments
Static &amp; dynamic characteristics of instrumentsStatic &amp; dynamic characteristics of instruments
Static &amp; dynamic characteristics of instruments
 
Av 738-Adaptive Filters - Extended Kalman Filter
Av 738-Adaptive Filters - Extended Kalman FilterAv 738-Adaptive Filters - Extended Kalman Filter
Av 738-Adaptive Filters - Extended Kalman Filter
 

Similar to State modeling

state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
Kumar
 
State Diagram.pdf
State Diagram.pdfState Diagram.pdf
State Diagram.pdf
ssuser226e3e
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
Ajit Nayak
 
State Diagrams
State DiagramsState Diagrams
State Diagrams
Vaidik Trivedi
 
Diagrams
DiagramsDiagrams
Diagrams
janessa24
 
States machine
States machineStates machine
States machine
Satyamevjayte Haxor
 
Java
Java   Java
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
ssuser2d043c
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
Edhole.com
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
Edhole.com
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1
Jenish Bhavsar
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programs
Priya Kaushal
 
Lecture08
Lecture08Lecture08
Lecture08
artgreen
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
Manoj Reddy
 
Objec oriented Analysis and design Pattern
Objec oriented Analysis and design PatternObjec oriented Analysis and design Pattern
Objec oriented Analysis and design Pattern
Ashish Kumar Thakur
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
Preeti Mishra
 
State diagram
State diagramState diagram
State diagram
Hareem Naz
 
State diagram
State diagramState diagram
State diagram
Hareem Naz
 
State diagram
State diagramState diagram
State diagram
Hareem Naz
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptx
NourhanTarek23
 

Similar to State modeling (20)

state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
 
State Diagram.pdf
State Diagram.pdfState Diagram.pdf
State Diagram.pdf
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
 
State Diagrams
State DiagramsState Diagrams
State Diagrams
 
Diagrams
DiagramsDiagrams
Diagrams
 
States machine
States machineStates machine
States machine
 
Java
Java   Java
Java
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programs
 
Lecture08
Lecture08Lecture08
Lecture08
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
 
Objec oriented Analysis and design Pattern
Objec oriented Analysis and design PatternObjec oriented Analysis and design Pattern
Objec oriented Analysis and design Pattern
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
 
State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptx
 

Recently uploaded

Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 

Recently uploaded (20)

Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 

State modeling

  • 2. Introduction • The structure of objects and their relationships to each other in a system described by its static structure i.e. the class model. • Some objects in a system have complex temporal behaviors, which must be carefully design. • Temporal phenomena that occur over an interval of time are properly modeled with a state • The state model examine changes to the objects and their relationships over time • The state model describes the sequence of operations that occur in response to events (external stimuli)
  • 3. Events • occurrence at a point in time – instantaneous – often corresponds to verb in past tense • e.g., alarm set, powered on – or onset of a condition • e.g., paper tray becomes empty, temperature drops below freezing • may logically precede or follow another or may be unrelated – e.g., Flight 123 must depart DDN before it can arrive in Delhi (causally related) – e.g., Flight 123 may depart before or after flight 345 departs DDN (causally unrelated) • Concurrent event: causally unrelated events; have no effect on one another
  • 4. Kinds of events Signal event: – the event of sending or receiving of a signal • Signal: an explicit one-way transmission of information from one object to another • may be parameterized – E.g., stringEntered(“Foo”) – sending of a signal by one object is a distinct event from its reception by another – Difference between signal and signal event – every signal transmission is a unique occurrence but we group them into signal classes to indicate common structure and behavior. • E.g., IA flight 123 departs from DDN on Jan 11, 2013 is an instance of FlightDeparture
  • 5. Signal class - UML notation << signal >> FlightDeparture airline flightNum city date keyword “signal” in << >> name of signal class attributes
  • 6. Kinds of Events • Change event – Event caused by satisfaction of a Boolean expression – Intent: Expression continually tested; when changes from false to true, the event happens – UML Notation: keyword when followed by parenthesized boolean expression • when(room temperature < heating set point) • when(room temperature > cooling set point) • when(battery power < lower limit) • when(tire pressure < minimum pressure)
  • 7. Kinds of Events • Time event – Event caused by the occurrence of an absolute time or the elapse of a time interval – for absolute time the UML Notation: keyword when followed by parenthesized expression involving time • when (date = Jan 1, 2013) – for time interval the UML Notation: keyword after followed that evaluate to a timeby parenthesized expression duration • after (n timeUnits) • after(10 seconds)
  • 8. States • an abstraction of values and links of an object • behavioral condition that persists in time • according to gross behavior of objects, set of values and links are grouped together into a state • often corresponds to – verbs with suffix of “-ing” • e.g., Boiling, Waiting, Dialing – the duration of some condition • e.g., Powered, BelowFreezing • UML Notation: a rounded box containing an optional state name Powered Waiting Dialing
  • 9. Contd. • In defining states – ignore attributes that do not affect the behavior of the object – lump together in a single state all combinations of values and links with the same response to events – E.g., except for leading 0’s & 1’s, the exact digits dialed do not affect the control of the phone line, so we can define a state Dialing and track the phone number as a parameter • Objects in a class have a finite number of possible states – Each object can only be in one state at a time – At a given moment of time, the various objects for a class can exist in a multitude of states • A state specifies the response of an object to input events – E.g., if a digit is dialed in state DialTone, the phone line drops the dial tone and enters state Dialing; – If the receiver is replaced in state DialTone, the phone line goes dead and enters state Idle.
  • 10. Symmetry between Events and States • Events represent points in time • State represent intervals of time. A state corresponds to the interval between two events received by an object Power turned on Power turned off Power turned on Powered Not Powered
  • 11. Transitions and Conditions • Transition: an instantaneous change in state – triggered by an event – Transition is said to fire upon the change from source to target state – Origin and target state of a transition are different states but may be the same – e.g., when a phone line is answered, the phone line transitions from the Ringing state to the Connected state. • Guard Condition: – boolean expression that must be true for transition to occur – checked only once, at the time event occurs; transition fires if true – E.g., when you go out in the morning (event), if the temperature is below freezing (condition), then put on your gloves (next state).
  • 12. State Diagrams • a graph whose nodes are states and whose directed arcs are transitions between states • specifies state sequences caused by event sequences • all objects in a class execute the state diagram for that class; diagram models their common behavior – Note: state names are unique within the scope of state diagram – A class with more than one state has important temporal behavior – A class is temporarily important if it has a single state with multiple responses to events
  • 13. State diagrams S T States Graphical state-modeling notation: – States: labeled rounded box – Transitions: directed arcs, labeled by triggering event, optional guard condition, and/or effects Specifies the response of an object to input events - ignores events except those for which behavior is prescribed Example: Transition
  • 14. State diagrams Graphical state-modeling notation: – States: labeled rounded box – Transitions: directed arcs, labeled by triggering event, optional guard condition, and/or effects Example: S T event(attribs) [condition] / effect States EventTransition
  • 15. • State diagrams can represent – Continuous loops • Do not care, how the loop is started – One-shot life cycles
  • 16.
  • 17. “One-shot” state diagrams • represent objects with finite lives – have initial and finite states • initial state - entered on object creation • final state - entry implies destruction of object
  • 19. Example - entry and exit points Chess game White’s checkmate stalemate stalemate checkmate turn black white moves moves Black’s turn Black wins Draw White wins
  • 20. State Model • multiple state diagrams, one for each class with important temporal behavior – diagrams interact by passing events and through side effects of guard conditions – events and guard conditions must match across diagrams in the model
  • 21. Details – if more than one transition leaves a state, then the first event to occur causes the corresponding transition to fire – if an event occurs and no transition matches it, the event is ignored – if more than one transition matches an event, only one transition will fire but the choice is non- deterministic
  • 23. Activity Effects • effect = reference to a behavior executed in response to an event – can be attached to a transition or a state – listed after a slash (“/”) – multiple effects separated with a “,”and are performed concurrently
  • 24. Activity Effects • Activity = behavior that can be invoked by any number of effects • May be performed upon: – a transition – entry to or exit from a state – some event within a state • Notation: – event / resulting-activity
  • 25. Activities Often useful to specify an activity that is performed within a given state – E.g., while in PaperJam state, the warning light should be flashing – E.g., on entry into the Opening state, the motor should be switched on – E.g., upon exit of the Opening state, the motor should be switched off
  • 26. Activity effects Idle Menu visible r_button_down / showPopup r_button_up / hidePopup
  • 27. Do-Activities • continue for an extended time • can occur only within a state • can not be attached to a transition • include • continuous operations, such as displaying a picture on a television screen • Sequential operations that terminate by themselves after an interval of time • may be performed for all or part of time that an object is in a state •may be interrupted by event received during execution; event may or may not cause state transition PaperJam do/ flash warning light
  • 28. Entry and Exit Activities Opening entry / motor up exit / motor off • can bind activities to entry to/ exit from a state •All transitions into a state perform the same activity, in which case it is more concise to attach the activity to the state
  • 29. Order of activities 1. activities on incoming transition 2. entry activities 3. do-activities 4. exit activities 5. activities on outgoing transition Events that cause transitions out of the state can interrupt do-activities. If a do-activity is interrupted, the exit activity is still performed
  • 30. • In general, any event can occur within a state and cause an activity to be performed. • Entry and exit are only two examples of events that can occur • Difference between an event within a state and self-transition: only the self-transition causes the entry and exit activities to be executed but an event within a state does not
  • 31. Completion Transition • triggered by completion of activity in the source state • Often the sole purpose of a state is to perform a sequential activity. • When the activity is completed, a transition to another state fires • An arrow without an event name indicates an automatic transition that fires State 1 do / blah() State 2
  • 32. Contd. • If a state has one or more completion transitions, but none of the guard conditions are satisfied, then the state remains active and may become ‘stuck’. • The completion event does not occur a second time • Therefore no completion transition will fire later to change the state • So if a state has completion transition leaving it, normally guard condition should cover every possible outcome. • Do not use guard condition on a completion transition to model waiting for a change of value
  • 33. Sending signals • A object can perform the activity of sending a signal to another object. • A system of objects interact by exchanging signals • The activity “send target.S(attributes)” sends a signal S with the given attributes to the target object. • E.g., the phone line sends a connect(phone number) signal to the switcher when a complete phone number has been dialed. • A signal can be directed to a set of objects or a single object. • If the target is a set of objects, each of them receives a separate copy of the signal concurrently and independently process the signal and determines whether to fire a transition or not • If an object receive signals from more than one object, the order in which concurrent signals are received may affect the final state (race condition)
  • 34. Advanced state modeling • Conventional state diagrams are sufficient for describing simple systems but need additional power to handle large problems • Model complex system by using – Nested state diagrams – Nested states – Signal generalization – Concurrency
  • 35. Nested state diagram • Problem with flat state diagram – Consider an object with n independent Boolean attributes that affect control – representing such object with a single flat state diagram would require 2n states • Expanding state – Organize the model by having high-level diagram with sub diagrams expanding certain states – Submachine: a state diagram that may be invoked as part of another state diagram (lower-level state diagram). – UML Notation for submachine: list a local name followed by a colon and the submachine name.
  • 36. Nested state • Nest states to show their commonality and share behavior • Composite state: state that encloses the nested states. – Labels in the outer contour • A nested state receives the outgoing transitions of its composite states
  • 37.
  • 39. Signal Generalization • Organize signals into generalization hierarchy with inheritance of signal attributes • View every actual signal as a leaf on a generalization tree of signals. • Received signal triggers transitions that are defined for any ancestor signal type. – E.g., typing an ‘a’ would trigger a transition on signal Alphanumeric as well as signal KeyboardCharacter. • A signal hierarchy permits different levels of abstraction to be used in a model. – E.g., some state might handle all i/p characters the same; other states might treat control characters differently from printing characters .
  • 40.
  • 41. CONCURRENCY • State model supports concurrency among objects • Object can act & change state independent of one another. • Sometime objects shares constraints that causes their state changes
  • 42. AGGREGATION CONCURRENCY • State Aggregation means collection of state diagrams , one for each part • “and” relationship • Aggregate state is one state from first diagram & a state from second diagram & state from each other diagram. • Transition for one object depend on another object that allows interaction between the state diagram.
  • 43.
  • 44. Concurrency within an Object • Some objects can be partitioned into subsets of attributes or links. • Each of the partitioned subset has its own subdiagram. • The state of the object comprises one state from each subdiagram. • The sub diagrams need not be independent; the same event can cause transitions in more than one subdiagram • UML Notation- partition the composite state into regions with dotted lines.
  • 45.
  • 46. Synchronization of Concurrent Activities • Sometimes one object must perform two ( or more) activities concurrently. • The object must complete both activities before it can progress to its next state.
  • 47. Fork and Join OR Splitting control and Merging control • FORK- A transition that forks indicates splitting of control into concurrent parts. • JOIN- Explicit merging of concurrent control by a transition.
  • 48. Relation of class model, state model • A state diagram describes all or part of the behavior of the objects of a given class. • States = classes of values & link for an object • State model of a class is inherited by its subclasses. Subclass inherits both the state & Transitions. • It is also possible to refine an inherited state diagram by expanding state into nested state or concurrent sub diagrams.
  • 49. Contd. • State structure is related to and constrained by class structure. – A composite state is the aggregation of more than one concurrent substate. – Try to make the state diagrams of subclasses independent of the state diagrams of their superclasses.