Table of Contents


CHAPTER III A MODELING TECHNIQUE FOR MESSAGE PASSING

This chapter presents a modelling technique for message passing in manufacturing systems. This modelling technique is a hybrid of object oriented paradigm, color timed Petri nets, and IDEF0.

First, the terminology of the object-oriented technique and color timed Petri nets, as used in this thesis, are defined. Next, a graphical representation based on object-oriented technique and color timed Petri nets is introduced. Finally, the integration of these modelling techniques is developed. 3.1 Terminology

Currently, a variety of terminology for both object oriented techniques and Petri nets can be found in the literature [Rumbaugh et al 1991] [Coad and Yourdon 1991] [BOOCH 1991] [Snyder 1991] [OMG 1991] [Coad and Yourdon 1990]. This section defines the terminology for both the object-oriented concept and Petri nets that is used in this thesis. 3.1.1 Object-Oriented Terminology

The terms which apply to the object-oriented approach, as used in this thesis, are given below. These terms include both object semantics commonly used in the object-oriented paradigm and those specifically developed for the object-oriented connection model.

In order to faithfully represent the elements of a manufacturing cell in a model such that the message passing capability can be analyzed, it is necessary to find a way to represent the components of the manufacturing system. Depending on the level of detail required, or desired, the component may be a a machine tool, or just its controller, or just the communication part of the controller. Further, since each component may provide or request either information or service, i.e., some function such as "is switch A on", or "remove 0.1 inch of material", or both, it is necessary to find ways to represent these basic functions and to differentiate between when a component is a requestor of service and when it is a provider of service. In order to discuss these matters precisely the following definitions will be employed.

An object is a meaningful abstraction of an element of the manufacturing system; for example, a machine tool controller may be represented as an object. A set of objects which have common structure and a common behavior may form a class. For example, there may be similar machine tools in a manufacturing system. Each may be defined by comparing its structure and behavior with establish templates. If no match exists, a new template may be established. A cluster of objects which have same structure and behavior forms a class. An object is simply an instance of a class.

Each object has at least two features, the service(s) it can provide and the information it needs, contains, or supplies. An object requests services from another object by issuing a "request". An object which issues a request is called a client object. An object which receives a request from other objects is called a server object. These roles are dynamic, depending upon the system state. An object may be in either client or a server role, but not both, for each system state.

In order for it to perform the service, a client object may need to provide some information to the server object. A request which contains some information from the client object is called a "request with data". A request may simply want a service performed by the server object. This type of request is called a "request without data" and is sometimes called a "trigger" in the control of manufacturing systems.

A request may require a "reply" of the server object. A reply contains the answer to a request. A reply may be just the indication of a service completed. This type of reply will be called a "reply without data" and is sometimes known as an "acknowledgment" in the control of manufacturing systems. Alternatively, a reply may contain some information from the server object and will be called a "reply with data". Thus, the interactions between objects will be in the form of "request" and "request-reply". An interaction in the form of "request-reply" pairs will be called a "communication". A communication between one object and another object will be called "communication between objects" in later chapter. A communication is always initiated by a client, never by a server.

A request or a reply between a client object and a server object is called a message in this research. Therefore, message may refer to either a request or a reply. A message which passes from a client object to a server object represents a request for a service to be performed in the server object.

How the service is performed by the server object is called a method. A server object will invoke a method in response to the message it receives. In performing its service an object may access or modify its data and/or may in turn require services from other objects. There maybe more than one method that a server object can use to perform its service. The collection of methods in an object is called the behavior of this object.

More precise definitions for the terms, as used in this thesis, are listed below. Definition 1: Object An object embodies an abstraction that is meaningful to other objects that may request its service. An object includes services and data. In performing its service an object may access or modify its data and may produce observable effects on other objects. Definition 2: Class A class is the template by which objects are defined. A set of objects which have similar patterns are clustered into a class. An object is an instance of a class. Definition 3: Client object An object which requests services from other objects by issuing requests will be referred to as a client object. Definition 4: Server object An object which provides services to clients will be referred to as a server object. Definition 5: Request A request is an event. The information associated with a request may consist of an action, and/or parameters(data). Definition 6: Reply A reply is an answer from a server object in response to a request from a client object. A reply may also contain an action, and/or parameters (data). Definition 7: Communication A communication is one interaction formed of a "request-reply" pair between a client object and a server object. Definition 8: Message A message is a general description of a request or a reply between a client object and a server object. Definition 9: Method A method is an implementation of a service in the object. The only portion of the implementation of a service which needs to be modeled in an object for message passing purposes is the data flow and control flow of this service. Definition 10: Behavior of an Object The collection of methods in an object is called the behavior of the object.

More precise definition of objects from the message passing perspective are given below. An object, o, is a 6-tuple, <MI, M, MO, SM, RM), where · MI is a set of messages that an object can receive. · M is a set of methods in an object; · MO is a set of messages that an object will send to request services of other objects; · SM is a one-to-one service mapping function, · SM: MI → M; · RM is a one-to-one request mapping function, · RM: MO → M; 3.1.2 Object Graphic Representation

Graphic symbols for representing an object and its corresponding types of requests are presented in this section. These graphic symbols will be used to construct a graphical model which will be described in a later chapter. 3.1.2.1 Request View of An Object An object is the basic component in the object oriented approach. The manufacturing system is to be represented as a collection of objects communicating with each other. An object can be viewed as the set of services that it can provide to or require from other objects, as shown in Fig. 9. In Fig. 9, an object is represented by a black box. The arrows entering the box from the left side shows the requests that the object can receive. The inner box in the object box shows a collection of methods for the services the object provides, which is the behavior of the object. The arrows out of the object box from some methods shows that services are required from other objects in order to complete its service. For example, method 2 requires two services from other objects. The relationships between requests and methods will be discussed in the following sections.

3.1.2.2 Types of Requests To An Object The requests a server object can receive can cause different roles in message handling in the server object. These are grouped into three categories based on their roles. Definition 11: Object Control Request An object control request is used to initialize an object. An object can be initialized during system initialization, or by request of another object through an object control request. Definition 12: Object State Request Object state request is used to change (update), or retrieve the state of an object. Definition 13: Object Manipulation Request All other requests falls into this category. 3.1.2.3 Object Box One of the features of IDEF0 is the use of different sides of the box to denote different box/arrow relationships. This feature can also provide a better visual understanding of object/request relationships. A box represents an object, instead of a function, in this thesis. An arrow represents a request. The three different types of requests that an object can receive are associated with different sides of the box. The requests that an object may send to other objects always leave from the right-hand side of the box (see Fig. 10). Object control requests always enter the top of the box, whereas the requests for object states enter the box from the bottom. Requests which require manipulation enter from the left of the box. With this edge designation, meaningful request information can be visually displayed.

3.1.3 Petri Net Terminology

A basic Petri net is composed of: a) a set of places, a place is normally drawn as a circle, b) a set of transition, a transition is normally drawn as a box, c) arcs between places and transitions, and d) tokens.

An arc represents an input or output relationship between a place and a transition. A place which is connected to a transition is called a pre-place of that transition. A place which is connected from a transition is called a post-place of that transition. The representation of places, transitions and their connections represent the static structure of a basic Petri net.

A token normally drawn as a solid dot may reside in a place. The token(s) will be assigned to a place(s) in a basic petri net to represent the initial condition (or status) of this net at the beginning.

The dynamic operation of a basic Petri net is portrayed simply by the moving of tokens among places by an enable rule and a firing rule. Enable Rule: A transition is enabled if every pre-place of the transition has a token. Firing Rule: A transition is fired as soon as it is enabled. The firing action is represented by removing a token from every pre-place of the transition and by depositing a token to every post-place of the transition. 3.1.4 Color Timed Petri Net Terminology

In this section, a color timed Petri net will be developed to model the behavior of objects. This color timed Petri nets integrates the time associated with transitions and color associated with tokens in basic Petri nets.

In basic Petri nets, a token is used to mark a place. One token is not distinguishable from another. The only significance of a token is its existence. In message passing, it is possible to use tokens interchangeably in a basic Petri net. It is also possible to use tokens to depict message flows. A token that is used to indicate message location must be differentiable from a token that is used to mark a place. Further, a token that is used to indicate the location of one message should be differentiable from another token representing another message. In advanced Petri nets, this is done by assigning different colors to different tokens. The same token color will be assigned to the same types of message. In order to indicate the types of tokens that are allowed to flow through from a place to a transition or from a transition to a place, a label is associated with each arc.

The use of color tokens alters the complexity of enableness conditions and firing rules. The pre-places and the tokens in these places together determine the pre-condition and enableness condition of a transition. A place may have more than one type of color tokens residing in it at different times. A transition expression is used to specify one firing operation in a transition. It determines which token is to be removed from every pre-place of the transition and which token is to be deposited to every post-place of the transition when the transition is fired. The collection of possible transition expressions for a transition will be called the transition firing operations. In order to avoid anomalies, each pre-condition of a transition expressions in a transition must be unique.

The transition expression can be used to represent different operations such as, transfer a token from one place to another, or convert a token to another token, or combine tokens into another token, or split a token into several tokens. When two tokens are combined to form a third, that 3rd token can be thought of as containing the two original tokens. A token which contains no other tokens is called a primitive token. A token which contains more than one token is called a container token. A container token can contain other container token(s) and/or primitive token(s). If the number of primitive tokens before a transition remains the same as the number of tokens after the transition, the transition is said to be token conservative. Token conservation is an important property of a transition.

In order to study time issues, it is necessary to represent time delays in Petri nets. Normally, a transition represents an action which requires time to complete. Therefore, a time delay function, D(t), is assigned to each transition in this thesis. D(t) can be a constant time or a stochastic time duration bounded by its minimum and maximum values. While D(t) is in the form of a duration, a transition may be fired anywhere between boundary values.

Basic Petri nets do not take time into consideration. Petri nets which associate a deterministic time with a transition are called "timed" Petri nets. Petri nets which do account for time duration are called "time" Petri nets. In this thesis, we need to differentiate tokens and need to account for time durations and therefore we need to use "color time Petri nets". However, in this research, we are only interested in the firing of a transition either at the minimum or at the maximum value of time duration. The two cases can be treated separately by two color timed Petri nets. Therefore, it is only necessary to define firing conditions for color timed Petri nets.

In the color timed Petri nets, a transition can be fired if the enable condition is still held after the time specified in the transition time function. The enable condition and firing of the color timed Petri nets will be defined.

More precise definitions of the color timed Petri net are given below. First, the notations and definitions used with color timed Petri nets are described. Next, the color timed Petri net graphic representation is given.

Notations used for the color timed Petri net are listed below.

A color timed Petri net, CTPN, is a 9-tuple, CTPN = (P,T, C, L, I-, I+, D, O, R) where: · P is a finite non-empty set of places, P = {pi| i > 0, i &OE; N); · T is a finite non-empty set of transitions, T = {tj | j > 0, j &OE; N); · C is a finite set of token colors, C ={ck | k > 0, k &OE; N}; · L is a finite non-empty set of labels; · I- is the input function which defines the input places to transitions · I-: P * T Æ L ; · I+ is the output function which defines the output places from transitions · I+: T * P Æ L ; · D is the time function which is associated with each transition, a constant; · R defines the firing operation for each transition; Definition 14: Primitive Token A primitive token (ptk) is a token which contains no other token. Definition 15: Container Token A container token is a combination of a set of primitive tokens and/or container token. A container token is defined as ctk = {tkm | m &OE; N}, where tk can be a primitive token or a container token. A container token can't contain itself. Definition 16: Token Color A token, tk, is assigned to a color by a color function, c = c(tk). Definition 17: Label A label ll denotes a set of tokens that may flow through the arc from a place to a transition or from a transition to a place. A label ll is represented as ll = {ck | ck &OE; C, k \xb3 0, k &OE; N}. Definition 18: Token Time Stamp A time stamp t is attached to each token in order to represent the time the token tkm is created at place pi. Thus, the time stamp of token tkm is represented as TTK(pi, tkm) = t. Definition 19: Pre-Condition and Post-Condition of a Transition A pre-condition pre(tj) of a transition tj is a set of (pi, ck) for each pre-place of the transition., where pi is a pre-place of the transition and ck is the token color. Similarly, A post-condition post(tj) of a transition tj is a set of (pi, ck) for each post-place of the transition, where pi is a post-place of the transition and ck is the token color. A pre-condition and a post-condition can be presented by { (p[1], c[1]), ... , (p[i], c[i]), ..., (p[n], c[n]) }, where [i] is an index for a pre- or post-place of the transition and the corresponding token color in the place, n is the total number of pre- or post-place. Definition 20: Transition Firing Operation A transition firing operation R(tr) defines a set of transition expressions for transition tr. Each transition expression defines a pair of pre-condition and post-condition and is represented by <pren(tj), postn(tj)>. The pre-condition defines the color of a token to be removed from each pre-place and the post-condition defines the color of a token to be deposited in each post-place. That is, R(tj) = {<pren(tj), postn(tj)>, n &OE; N}. Definition 21: Enable Condition A transition tr is in enable condition if one pre-condition is satisfied. That is, $ n &OE; N, ' " (pi, ck) &OE;pren(tj), $ tk in place pi, such that c(tk) = ck. Definition 22: Firing A transition tj is fired at time D if it is in enable condition for D(tj). That is, $ n &OE; N, ' " (pi, ck) &OE;pren(tj), $ tk in place pi, such that c(tk) = ck and D \xb3 TTK(pi, tk) + D(tj). 3.1.5 Color Timed Petri Net Graphic Representation

The graphical symbols to represent the elements of the color timed Petri net are shown in Fig. 11.

3.1.6 Properties of Color Timed Petri Nets for Message Passing

The properties for basic Petri net have been well defined and accepted in the literature. However, in advanced Petri nets, the properties are defined for the convenience of the specific application domain. This is also the case in this research. In this section, the properties associated with basic Petri nets will be given first. Then, the definitions germane to message passing will be provided.

In a basic Petri net, a marking is defined as the pattern of token placements for a given state. Different marking patterns characterize different states of a net. In a Petri net with n places, a marking m is an n-vector, m = (m1, m2, ..., mn), where n=|P| and mi &OE; N, i = 1, ..., n, defines the number of tokens in each place [Peterson 1981]. Each element in the marking m(pi) represents the number of tokens in the place pi of the marking m and is called a marking element. Based on the definition of marking, boundedness and safeness and liveness will be defined.

A place is said to be k-bounded if the number of tokens in that place can not exceed an integer k. A basic Petri net is said to be k-bounded if every place of the net is k-bounded. Safeness is a special case of the boundedness property for k = 1. Boundedness can be used to check if a system has a finite number of states and to capture the capacity limitations of resources modeled as places.

The liveness property is defined based on the change of markings due to transitions. Assume m1 is the current marking and m2 is the marking after a transition tj is fired. In this case, m2 is said to be immediately reachable from m1. A reachable set R(C, m) of a basic Petri net C with marking m is defined as a set of all markings which are reachable from m. A transition tj of a basic Petri net C is potentially firable in a marking m if there exists a marking m' &OE; R(C, m) and tj is enabled in m'. A transition is live in a marking m if it is potentially firable in every marking in R(C, m).

In CTPN, tokens are classified into colors to model different messages and system status. A transition tj is fired after a time delay. The above definitions of markings and liveness for the basic Petri net may not be suitable to define the properties of a color timed Petri net. Also, another dimension on boundedness with respect to the colors of tokens in a place may also be of interest and will be defined as color boundedness.

In a color timed Petri net, a marking represents token assignment both in terms of numbers and colors in each place. Each element in the marking m(pi) in a CTPN defines the number of tokens for each color of tokens. A special case is when there is only one token in a place at any time. In this case, the representation of a marking element m(pi) may be reduced to be color of the token c. As it will be seen in the next chapter, the design of the CTPN for an object is safe in terms of number of tokens. Therefore, a marking definition which is useful to this thesis will be defined.

For a transition to be firable, the token type in pre-places must conform to some pre-condition of the transitions. Therefore, we introduce a new definition color-boundedness for CTPN. In essence, a place is said to be k-color-bounded with respect to a set of k token colors if that place can only be marked with tokens belonging to that token color set. A place in a color timed Petri net is said to be color-safe with respect to one specific token color if the place can only be marked by that type or color token. A reachable set R(CTPN, m) of a color timed Petri net CTPN with marking m is a collection of all markings which are reachable from the marking m. A transition tj of a color timed Petri net CTPN is potentially firable in a marking m if there exists a marking m' &OE; R(CTPN, m) and tj if enabled in m'. A transition is live in a marking m if it is potentially firable in every marking in (CTPN, m).

More precise definitions and assumptions are listed below. Definition 23: Markings of a Color Timed Petri Net A marking m can be defined as an n-vector, m = (m1, m2, ..., mn), where n = |P| and each element m(pi) = tkj is the token identification for the single token in place pi. Definition 24: Color Boundedness A place pi &OE; P of a CTPN with an initial marking m is k-color-bounded with respect to a set of tokens {cm, m &OE; N, m £ k} for all m' &OE; R(C, m), c(m'(pi)) &OE; {cm , m &OE; N, m £ k}. Definition 25: Color Safeness A place pi &OE; P of a color timed Petri net CTPN with an initial marking m is color-safe if the place is color-bounded with k = 1. Definition 26: Liveness A color timed Petri net is live if and only if $ a firing sequence, i.e., a sequence of firing transitions, ' the marking m' is reachable from m by firing the sequence of transitions. 3.2 Integration of Objects and the Color Timed Petri Nets

This section will describe the integration of the object oriented technique and the color timed petri nets. In order to be more specific to the unified modelling technique, the general definitions of the previous section are further divided into sub-categories.

First, graphical representation of types of message will be described. Second, in order to keep consistent with the color timed Petri net representation, messages are transformed into a token representation. The transformation procedure is defined. Finally, a detailed communication representation between two objects is presented. 3.2.1 Object Connections

An object sends a message to another object to request a service. A request can be either synchronous or asynchronous. If a request is synchronous, the client object has to wait for the reply. On the other hand, if the request is asynchronous, the client object can continue its service without waiting for the reply even if a reply is required. The reply will be considered as another request from the server object to the client object. In order to represent the interaction patterns clearly, it is desirable to have a way to explicitly and graphically represent the "request-reply" pair. A "request-reply" pair may result in some time delay.

Based on the explanations in section 3.1.1, interactions between two objects may fall into following combinations: "request only" and "request-reply". Taking the type of request into consideration, "request only" can be further classified into: "request with data" and "request without data". The "request without data" can be used to model actions, triggers, and events [Champeaux 1991] [Wirfs-Brock 90] . Similarly, a reply can be further classified into: "reply with data" and "reply without data". A "reply without data" can be used to model an acknowledgment. In summary, the interactions between two objects may fall into one of the six possible combinations: "request without data", "request with data", "request without data/reply without data". "request without data/reply with data", "request with data/reply without data", and "request with data/reply with data". Since a message can represent a request or a reply, a combination of request and reply can be represented by two messages with opposite directions. In the following, a graphic representation for each of the six combinations will be described and will be called an "object connection".

In Fig. 10 of section 3.1.2, the arrow heads convey the request direction only. In order to differentiate request/reply combinations, different arrow representations are defined, as shown in Fig. 12. A request/reply is represented by a line with two arrow heads which connects the two objects. Note that in the definition of object box, a request always leaves from the right-hand side of a client object. The solid arrow head represents the "with data" situation. A line with one arrow means an asynchronous request, a request without reply. Since arrows are single directional to/from opposite sides of the object box, the request and reply will not cause confusion.

3.2.2 Types of Tokens in Message Passing

In Petri net modelling, message passing and state changes are represented by the movement of tokens. In object oriented modeling, an event occurs due to message passing among objects. In order to be consistent with Petri net conventions, tokens will be used to represent messages passing between objects. A message can be represented by an action token alone or by an action token with one or more data token(s). The message of a reply can also be represented by a confirmation token or data token(s). More precise definitions of action token and data token are given below. Definition 27: Action Token A request without data is defined as an action token. An action token is always a primitive token. Definition 28: Data Token Each data token can represent only one type of data or one instance of a data type. Definition 29: Confirmation Token A reply without data is defined as a confirmation token. A confirmation token is always a primitive token. In general, a confirmation token is used to represent an acknowledgment. Definition 30: Message Token A message token is used to represent a message. It may be a primitive token or a container token. A message which contains data is defined by one message token and as many data tokens as required to represent all data types. 3.2.3 Communication Representation

Object connections depict message relationships between objects. However, an object is represented internally by a Petri net. A request enters the Petri net through one place and a reply exits the Petri net from another place. In order to associate a request and a reply with places explicitly, an object connection with two arrow heads must be split into two one way arrows, each of which will be referred to as a link. For example, a request without reply is represented by a link between these two objects. The link from a client object to a server object will be called a request link. When a reply is required, another link is used between these two objects. The link from a server object to a client object will be called a reply link. In other words, a request/reply is comprised of two links: a request link and a reply link. If there are more than one token on the link, the tokens are treated as a container token in color timed Petri net. A link is more precisely defined as follows. Definition 31: Link A link is a directed message path for specific token color(s) between objects. Thus, a link, ln, is represented by <oi, l, oj>, where oi is starting object, oj is destination object, and l is a set of token colors passing between oi and oj. "l" can be a set consisting of an action token, a data token, a confirmation token, or a combination of an action token and one or more data tokens.

A request without data which requires reply with data from a server object, shown and explained in section 3.2.1, can be represented by two links, shown in Fig. 13. The token on a request link will enter a place in the server object from a place in the client object. Conversely, a token on a reply link will leave from a place in the server object and enter a place in the client object. The four circles in Fig. 13 are used to represent four different places.

3.2.4 A Method/Places View of Object for Message Passing

A request is sent by a method in a client object. A corresponding method in a server object will provide service to this request. When a reply is required, it leaves the method in a server object and enters the method in the client object. In a more detailed level, the links and their associated places defined in the previous section clearly define the interactions between method and message.

The graphic representation of this method/places is shown in Fig. 9. Links which enter the object from the left-hand side may be request links and/or reply links from other objects. For example, a request link and a reply link are connected to the method 2 from the left-hand side of the object box. Therefore, a request/reply pair will be separated in different sides of the object. The message reachability analysis in Chapter VI will be developed based on this object view.

The object definition from the message passing perspective is given below. An object is a 6-tuple, (LN-, RI, PI, M, LN+, P, SP, RP), where · LN- is a set of links that an object can receive; · RI is set of request links that an object can receive and is a subset of LN-; · PI is set of reply links that an object can receive and is a subset of LN-; · M is a set of methods in an object; · LN+ is a set of links that an object will send to other objects; · P is a set of input and output places; · SP is a one-to-one service mapping function, · S: RI M * P; · R is a one-to-one request mapping function, · R: M * P LN+; 3.2.5 Synthesis of Color Timed Petri nets

Occasionally, it is necessary to combine Petri net representations of objects into a large net. In that case, a link may be represented as a transition and two directed arcs. For example, a link which connects two objects, o1 and o2, with token set, l, is represented as <o1, l, o2>. The label associated with each arc is l. The transition time is 0. The representation of a link in color timed Petri nets is shown in Fig. 15. Place, p1, is an output place of an object, o1. Place, p2, is an input place of another object, o2. The time delay, d, associated with transition t is 0.