Modeling State-Dependent Objects Using Colored Pet
Modeling State-Dependent Objects Using Colored Pet
net/publication/228721892
Article
CITATIONS READS
10 2,159
2 authors:
All content following this page was uploaded by Robert Gayle Pettit on 20 August 2015.
Abstract. This paper describes an approach for using Petri nets to model and analyze the
behavioral characteristics of state-dependent objects represented in the Unified Modeling
Language (UML). Specifically, this paper describes an approach for systematically
mapping UML state-dependent objects and their corresponding statecharts into colored
Petri nets. This work is part of an on-going effort to automate the behavioral analysis of
concurrent and real-time object-oriented software designs. The benefit of this approach is
that by providing a systematic means for modeling state-dependent objects using colored
Petri nets and relating this to the larger research effort, the overall concurrent architecture
may then be modeled and analyzed using a single, cohesive technique.
1 Introduction
This paper presents an approach for using colored Petri nets to model and subsequently
validate the behavioral characteristics of state-dependent objects represented in the Unified
Modeling Language (UML) [1;2]. This research represents part of a larger effort [3] to
integrate colored Petri nets with UML software architectures created using the COMET
method [4]. The goal of this overall effort is to provide a systematic and seamless integration
of CPNs with object-oriented software architectures in order to effectively model and analyze
the behavioral properties of an architecture prior to implementation.
In COMET (Concurrent Object Modeling and Architectural Design Method), state-
dependent objects are active (asynchronous) objects that react to stimuli based on the current
state of the object. Each state-dependent object has an associated statechart that defines the
state-based behavior for that object. Typically, a state-dependent object will have one input
interface (operation) for processing events. When an event is received, the state-dependent
object will then use the encapsulated statechart information to determine the appropriate
behavior to execute. Based on the input that was received and the current state of the object,
this behavior could range from simply changing states; executing some action; sending a
message to other objects; or no behavior at all.
There are several tools currently available to simulate statechart execution. The benefit of
this approach is that by providing a systematic means for modeling state-dependent objects
using colored Petri nets and relating this to the larger research effort mentioned above, the
overall concurrent architecture may then be modeled and analyzed using a single, cohesive
technique.
The Petri net formalism was chosen based on its modeling and analytical power for
concurrent systems. There are three general characteristics of Petri nets that make them
interesting in capturing concurrent, object-oriented behavioral specifications. First, Petri nets
allow the modeling of concurrency, synchronization, and resource sharing behavior of a
system. Second, there are many theoretical results associated with Petri nets for the analysis
of such issues as deadlock detection and performance analysis. Finally, the integration of
Petri nets with an object-oriented software architecture provides a means for automating
behavioral analysis.
The basic notation for Petri nets is a bipartite graph consisting of places and transitions
that alternate on a path and are connected by directional arcs [5]. In general, circles represent
places, whereas bars or boxes represent transitions. Tokens are used to mark places, and
under certain enabling conditions, transitions are allowed to fire, thus causing a change in the
placement of tokens.
A colored Petri net (CPN) is a special case of Petri net in which the tokens have
identifying attributes; in this case the color of the token [6]. At first, colored Petri nets seem
less intuitive than the basic Petri net. However, by allowing the tokens to have an associated
attribute, colored Petri nets scale to large problems much better than basic Petri nets.
COMET is a Concurrent Object Modeling and Architectural Design Method for the
development of concurrent applications, in particular distributed and real-time applications
[4]. As the UML is now the standardized notation for describing object-oriented models [1,2],
the COMET method uses the UML notation throughout.
The COMET Object-Oriented Software Life Cycle is highly iterative. In the Requirements
Modeling phase, a use case model is developed in which the functional requirements of the
system are defined in terms of actors and use cases.
In the Analysis Modeling phase, static and dynamic models of the system are developed.
The static model defines the structural relationships among problem domain classes. Object
structuring criteria are used to determine the objects to be considered for the analysis model.
A dynamic model is then developed in which the use cases from the requirements model are
refined to show the objects that participate in each use case and how they interact with each
other. In the dynamic model, state dependent objects are defined using statecharts.
In the Design Modeling phase, an Architectural Design Model is developed. Subsystem
structuring criteria are provided to design the overall software architecture. For distributed
applications, a component based development approach is taken, in which each subsystem is
designed as a distributed self-contained component. The emphasis is on the division of
responsibility between clients and servers, including issues concerning the centralization vs.
distribution of data and control, and the design of message communication interfaces,
including synchronous, asynchronous, brokered, and group communication. Each concurrent
subsystem is then designed, in terms of active objects (tasks) and passive objects. Task
communication and synchronization interfaces are defined. The performance of real-time
designs is estimated using an approach based on rate monotonic analysis.
The aspect of the COMET method that is specifically addressed in this paper is the
emphasis on dynamic modeling, in the form of both object interaction modeling and finite
state machine modeling, describing in detail how object collaborations and statecharts
[8,9,10] work together.
3 Statecharts in the COMET Method
Traditionally, finite state machines were modeled by means of state transition diagrams or
state transition tables. One of the potential problems of state transition diagrams is the
proliferation of states and transitions, thereby making the state transition diagram very
cluttered and difficult to read. A very important way of simplifying state transition diagrams
was made by Harel with the introduction of statecharts [8,10], which increases the modeling
power of state transition diagrams by introducing superstates and the hierarchical
decomposition of superstates.
Significant simplification of statecharts can often be achieved through the use of
hierarchical decomposition of states, where a superstate is decomposed into two or more
interconnected substates. This decomposition is sometimes referred to as the or
decomposition, because being in the superstate means that the statechart is in one and only
one of the substates. The hierarchical statechart notation also allows a transition out of every
one of the substates on a statechart to be aggregated into a transition out of the superstate.
Careful use of this feature can significantly reduce the number of state transitions on a
statechart.
Another kind of hierarchical state decomposition supported is the and decomposition.
That is, a state on one statechart can be decomposed into two or more concurrent statecharts.
When the higher-level statechart is in the superstate, it is simultaneously in one of the
substates on the first lower-level concurrent statechart and in one of the substates on the
second lower-level concurrent statechart.
Although the name concurrent statechart implies that there is concurrent activity within
the object containing the statechart, the and decomposition can be used to show different
aspects of the same object, which are not concurrent. This latter approach is used in the
COMET method.
State dependent objects are control objects whose behavior depends not only on the input
received, but also on the current state. In COMET, a state dependent object is described by
means of a statechart. A complex system can have many state dependent objects and hence
several statecharts. COMET encourages the design of objects with only one thread of control;
to address concurrency, multiple concurrent objects can be used. The Cruise Control system
described in this paper has one state dependent object and hence one statechart. However, in
other case studies given in [4], there are examples of distributed control in which the control
aspects of the system are distributed among many state dependent objects, each described by
its own statechart. If there are many objects of the same type, then each object will execute an
instance of the same statechart.
Using the COMET method, state-dependent objects are defined to encapsulate the behavior
specified by a statechart. These state-dependent objects provide an interface for receiving
events and then perform some behavior based on the input event, the current state, and the
state-transition specifications of the encapsulated statechart.
To fit within the context of modeling a large-scale concurrent software architecture, the
approach used in this paper to specifically model state-dependent objects must address both
the high-level behavioral structure of state-dependent objects as well as the specific state-
dependent behavior of the associated statechart. To capture both of these aspects, the
resulting CPN model is structured using a series of hierarchical decompositions as described
in the following sections.
Using our approach, the top-level CPN model captures the high-level state-dependent object
as a whole. This top-level model is illustrated in Figure 1. At this level, we can see the
interface between the state-dependent object and its surrounding environment, including
input events, output actions, the current state, and the high-level control flow within the
object.
To model the specific state-dependent behavior, each of these CPN State transitions from
Figure 2 is again decomposed into a lower-level CPN segment. This final level of
decomposition is shown in Figure 3.
ExecuteSTD
1`(inputEvent,CTRL) State1
InternalEvent HS 1`(State1,…)
P In
EventRx
1`(inputEvent,CTRL)
1`newState
State P I/O
1`(inputEvent,CTRL)
1`(State2,…)
State2 CurrentState
HS
1`newState
1`CTRL
Control 1`CTRL
P Out 1`newState
STDComplete
1`(newState,0) 1`(newState,1)
1`(newState,N)
InternalEvent
P In 1`(StateN,…)
EventRx State-n-Action0a State-n-Action1a State-n-ActionNa
1`newState P I/O
State
. CurrentState
State-n-State1ab .
. State
1`newState
State-n-Action1b
1`newState 1‘newState
1‘ CTRL State
Control
P Out
STDComplete State-n-State1bc
1‘ CTRL
1`newState
1‘ newState
State-n-Action1c
The Cruise Control System [4] is a real-time control system that manages the speed of an
automobile based on inputs from the driver (via a lever on the steering column). The
behavior of the cruise control is state-dependent in that the executed actions correspond not
only to the driver input, but also on the current state of the system and with the status of the
engine and the brake.
To illustrate the modeling of state-dependent objects using CPNs, we will use the state-
dependent “:CruiseControl” object and corresponding statechart from the Cruise Control
System. In this example, the :CruiseControl object accepts external inputs/events and
executes the cruise control statechart. Figure 4 provides a partial collaboration diagram
illustrating this state-dependent object along with its interfaces to the rest of the cruise control
system. As can be seen from this figure, the :CruiseControl object accepts event inputs from
the cruise control lever interface indicating whether the driver has selected to accelerate
(Accel), engaged the cruise (Cruise), turned the cruise off (Cruise Off), or requested that
cruising be resumed (Resume). Furthermore, the :CruiseControl object must accept
messages from the SpeedControl object indicating that the cruising speed has been reached
and accept inputs indicating the current status of the brake (Pressed or Released) and engine
(On or Off). Finally, in terms of output actions, the :CruiseControl object must set (or clear)
the desired speed and must send appropriate (state-based) commands to the SpeedControl
object that controls the throttle output and monitors the current speed.
The statechart for the :CruiseControl object is shown in Figure 5. The leaf (lowest-level)
states for :CruiseControl are: Idle, Initial, Accelerating, Cruising, Resuming, and Cruising
Off. It is these low-level states that will be used for the CPN state-dependent modeling.
This paper presents a systematic, scaleable, and repeatable approach for using colored Petri
nets to model the behavior of UML objects containing statecharts, which is capable of being
automated. This approach may be integrated into the larger effort of modeling the overall
concurrent software architecture using CPNs. The resulting CPN is then used to validate
such dynamic properties as the absence of deadlock and starvation conditions as well as
providing a timing and behavioral analysis of the architecture through simulation. This
analysis through CPNs reduces the overall risk of software implementation by allowing
behavioral characteristics to be validated from an architectural design rather than waiting for
the system to be coded.
This paper represents on-going research efforts to integrate colored Petri nets with object-
oriented software design methods for concurrent and real-time systems. Future research will
explore the automatic generation of CPNs from UML. It is the goal of this continuing
research to arrive at a set of CPN translation rules that can be effectively integrated with
software design methods to provide increased reliability and analytical capabilities at
multiple levels of abstraction.
7 References
[1] Rumbaugh, J., Jacobson, I., and Booch, G., The Unified Modeling Language Reference
Manual Reading, Mass.: Addison-Wesley, 1999.
[2] Booch, G., Rumbaugh, J., and Jacobson, I., The Unified Modeling Language User
Guide Reading, Mass.: Addison-Wesley, 1999.
[3] Pettit, R. G. and Gomaa, H. “Validation of Dynamic Behavior in UML Using Colored
Petri Nets.” UML 2000 Behavioral Semantics Workshop. York, England. October,
2000.
[4] Gomaa, H., Designing Concurrent, Distributed, and Real-Time Applications with UML,
Addison Wesley Object Technology Series, 2000, http://www.aw.com/cseng/titles/0-
201-65793-7.
[5] David, R. and Alla, H., "Petri Nets for Modeling of Dynamic Systems: A Survey,"
Automatica, vol. 30, no. 2, pp. 175-202, 1994.
[6] Jensen, K., Coloured Petri Nets: Basic Concepts, Analysis Methods, and Practical Use
Berlin, Germany: Springer-Verlag, 1997.
[8] Harel, D., "On Visual Formalisms." CACM 31, 5 (May 1988), 514-530.
[9] Harel, D. and E. Gary, "Executable Object Modeling with Statecharts", Proc. 18th
International Conference on Software Engineering, Berlin, March 1996
[10] Harel, D. and M. Politi, "Modeling Reactive Systems with Statecharts", New York, NY:
McGraw-Hill, 1998.