Mapping UML Diagrams to a Petri Net Notation

Скачать презентацию Mapping UML Diagrams to a Petri Net Notation Скачать презентацию Mapping UML Diagrams to a Petri Net Notation

17e49f0535cc525ceaff1676da27a158.ppt

  • Количество слайдов: 45

Mapping UML Diagrams to a Petri Net Notation for System Simulation Zhaoxia Hu (zhu@cs. Mapping UML Diagrams to a Petri Net Notation for System Simulation Zhaoxia Hu ([email protected] uic. edu) Supervised by Dr. Sol M. Shatz Concurrent Software Systems Laboratory Department of Computer Science University of Illinois at Chicago June 22, 2004

Outline Motivation p Contribution p n n Model construction Model analysis based on simulation Outline Motivation p Contribution p n n Model construction Model analysis based on simulation Related work p Future directions p

Motivation Integrating formal methods (Petri nets) with object-oriented design concepts (UML) to benefit from Motivation Integrating formal methods (Petri nets) with object-oriented design concepts (UML) to benefit from the strengths of both approaches p Providing software designers with the tools to achieve model analysis for concurrent systems in the early stage (the design stage) of the software development life cycle. p Leveraging upon existing techniques and tools (Rational Rose Tool, Design/CPN Tool). p

The cpn. UML approach: Overview p p p Original model: UML statecharts and collaboration The cpn. UML approach: Overview p p p Original model: UML statecharts and collaboration diagrams Target model: colored Petri nets Objective n p Model analysis based on simulation An incremental approach n n Basic Statecharts containing composite states

Statechart diagrams and collaboration diagrams p A statechart specifies the set of states an Statechart diagrams and collaboration diagrams p A statechart specifies the set of states an object goes through during its lifetime in response to events, together with its responses to those events. -- an object-based variant of classical (Harel) statecharts p A collaboration diagram is an interaction diagram that emphasizes the structural organization of the objects that send and receive messages.

Petri Nets p Petri nets n p A formal language that allows the modeling Petri Nets p Petri nets n p A formal language that allows the modeling of concurrency Colored Petri nets n Tokens are differentiated by colors, i. e. , data types p 2 t 1 p 1 t 2 p 4 t 3 red blue red p 3 t 4 p 5

The Design/CPN tool p Supports n n p Construction and editing of large, hierarchical The Design/CPN tool p Supports n n p Construction and editing of large, hierarchical colored Petri nets. Simulation (automatic and interactive) Performance analysis based on simulation Verification by means of state spaces History n Originally developed by Meta Software, Cambridge MA, USA – in close cooperation with the CPN group at University of Aarhus Denmark p p n First vision was finished in 1989. More than 40 man-years have been used for the design and implementation. From 1996 the distribution, maintenance and further development is done by the CPN group at the University of Aarhus, Denmark. p After less than two months version 3. 0 is used by 100 organizations from 30 countries all over the world.

Contributions p Construction of the target colored Petri net model p Methodologies for using Contributions p Construction of the target colored Petri net model p Methodologies for using the target model to achieve model analysis based on simulation

From UML to CPN p Two steps n A UML model an abstract colored From UML to CPN p Two steps n A UML model an abstract colored Petri net model Delays binding our transformation approach to a specific CPN notation so that our transformation approach can be implemented by any standard CPN analyzer to support analysis of the resulting CPN. p Separation of concerns p n An abstract colored Petri net model a target net model supported by Design/CPN

The abstract net model p p p An abstract system-level model consists of Object The abstract net model p p p An abstract system-level model consists of Object Net Models (ONMs) and an Internal Linking Place (ILP) place An ONM describes the behavior of an individual object (from statechart) The ILP place defines the communication between the objects (from collaboration diagram) n n Routing tokens Replicate tokens OVEN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . LM of the Power Tube OP OTA <{L 2, L 1}> IP. . LM of the USER Light Tube <{}> USER . . . ITA IP . . . ER ER OP OP OTA . . . LM of the Light Tube

Generic Object Petri Net Model p Object IP. . . LM of the Object Generic Object Petri Net Model p Object IP. . . LM of the Object In-place . . . Out-place OP p p ITA incoming external events Event Router ER OTA Outgoing external events Lifetime behavior model (LM) Event routing structure The semantics of UML statecharts (a hypothetical machine) n An event queue – holds incoming event instances until they are dispatched. n An event dispatcher – selects one event at a time from the queue. p Nondeterministic choice n An event processor – processes the dispatched events.

From Statecharts to Abstract Colored Petri Nets p Object IP <type, ex> ITA incoming From Statecharts to Abstract Colored Petri Nets p Object IP ITA incoming external events . . . In-place LM of the Object Event Router . . . Out-place OP ER OTA Outgoing external events Basic transformation n States – places n UML Transitions – Petri net transitions n Events – event tokens (to be consumed, stored in input place) n Actions – event tokens (to be generated, stored in event router place)

From abstract to target model: The target model structure OVEN Design/CPN Power Tube IP From abstract to target model: The target model structure OVEN Design/CPN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . LM of the Power Tube OP OTA -- Each page contains a small net structure. <{L 2, L 1}> IP. . LM of the USER Light Tube <{}> USER . . . ITA IP OP OTA . . . ER ER OP -- CPN Hierarchy: A colored Petri net typically consists of several pages. LM of the Light Tube -- These pages constitute the hierarchical structure of the net model.

From abstract to target model: The target model structure OVEN Power Tube IP . From abstract to target model: The target model structure OVEN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . main page LM of the Power Tube OP INL page OTA object page 1 object page n <{L 2, L 1}> IP. . LM of the USER . . . ITA IP OP OTA . . . ER ER OP -- The net structure of the target model consists of a two-level tree structure Light Tube <{}> USER LM of the Light Tube -- The main page describes the high level view of the system. -- INL page and object pages describes the details of the net model for the system.

Hierarchical structure of the net model -- Substitution transition: Allows a net transition in Hierarchical structure of the net model -- Substitution transition: Allows a net transition in the toplevel page to represent the entire net structure of a bottom-level page (subpage). -- Sockets and ports: -- colored Petre net places that exist in different locations in a net to act functionally as if they were the same place. -- Allows bottom-level pages to connect to the top-level page. p An example of a toplevel page socket substitution transition T 1 socket S 2 S 1 T 2 substitution transition main page INL page object page 1 object page n

An example UML model: Master-Servant system Init Idle Start /Start Active Waiting (a) Statechart An example UML model: Master-Servant system Init Idle Start /Start Active Waiting (a) Statechart for Master (b) Statechart for Servant 1: Start Servant (c) Collaboration Diagram

From abstract to target model: The target model structure OVEN Power Tube IP . From abstract to target model: The target model structure OVEN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . main page LM of the Power Tube OP INL page OTA object page 1 object page n <{L 2, L 1}> IP. . LM of the USER . . . ITA IP OP OTA . . . ER ER OP -- The net structure of the target model consists of a two-level tree structure Light Tube <{}> USER LM of the Light Tube -- The main page describes the high level view of the system. -- INL page and object pages describes the details of the net model for the system.

What is a main page? p p Depicts a high-level view of the model What is a main page? p p Depicts a high-level view of the model structure with the help of substitution transitions. Consists of n n A substitution transition, which represents the INL sub page, which models the communication among the objects A substitution transition for each object, which represents the object page An input place (IP) and output place (OP) for each object. These places are the sockets. Arcs with inscriptions

The Main Page for the Master-Servant example -- Subsitution transitions for INL page, and The Main Page for the Master-Servant example -- Subsitution transitions for INL page, and object pages; Places IP and OP; and Arcs socke t

From abstract to target model: The target model structure OVEN Power Tube IP . From abstract to target model: The target model structure OVEN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . main page LM of the Power Tube OP INL page OTA object page 1 object page n <{L 2, L 1}> IP. . LM of the USER . . . ITA IP OP OTA . . . ER ER OP -- The net structure of the target model consists of a two-level tree structure Light Tube <{}> USER LM of the Light Tube -- The main page describes the high level view of the system. -- INL page and object pages describes the details of the net model for the system.

What is an object page? p p p Describes the behavior of an object. What is an object page? p p p Describes the behavior of an object. Captures the token routing that characterize any ONM. Types of Tokens n Active Used to specified the state which the object is currently in p An instance of Active tokens is denoted as A. p n Local Event Token External and Internal p An instance of Local event tokens is denoted as (External, event_name) or (Internal, event_name). p

The object page for the Servant object port Idle Start Active Statechart for Servant The object page for the Servant object port Idle Start Active Statechart for Servant

The object page for the Master object port Init /Start Waiting Statechart for Master The object page for the Master object port Init /Start Waiting Statechart for Master

From abstract to target model: The target model structure OVEN Power Tube IP . From abstract to target model: The target model structure OVEN Power Tube IP . . . LM of the OVEN . . . Event ITA IP <{V 1, V 3, V 4}> ER <{P 2, P 1}> ER ILP OP . . . ITA . . . main page LM of the Power Tube OP INL page OTA object page 1 object page n <{L 2, L 1}> IP. . LM of the USER . . . ITA IP OP OTA . . . ER ER OP -- The net structure of the target model consists of a two-level tree structure Light Tube <{}> USER LM of the Light Tube -- The main page describes the high level view of the system. -- INL page and object pages describes the details of the net model for the system.

What is an INL page? p p Models the communication among the objects Has What is an INL page? p p Models the communication among the objects Has two functions: n n p p Routing tokens to their destination objects Replicating tokens when it is necessary for a message to be available to multiple objects Is derived from the abstract ILP place of the abstract system model Has global event tokens n An instance of global event tokens is denoted as (object_id, event_name).

The INL page for the Master-Servant example port The INL page for the Master-Servant example port

Contributions p Construction of the target colored Petri net model p Methodologies for using Contributions p Construction of the target colored Petri net model p Methodologies for using the target model to achieve model analysis based on simulation

Simulation traces p Design/CPN supports n n n Interactive simulation Automatic simulation Simulation results Simulation traces p Design/CPN supports n n n Interactive simulation Automatic simulation Simulation results -- simulation reports (The default simulation report is not useful) 1 A ***@(1: New#2) {} 2 A ***@(1: New#2) {} 3 A ***@(1: New#2) { tok = Start} 4 A ***@(1: New#4) p Enable users who are not familiar with Petri net notation to reason about model behaviors. p Map simulation results back to UML notation.

Simulation trace Master: Init -> Waiting | Start Servant: Idle -> Active Start | Simulation trace Master: Init -> Waiting | Start Servant: Idle -> Active Start | -- A code segment is defined for each critical transition. -- A code segment is a sequential piece of Meta Language code. -- A code segment is executed each time the associated net transition fires. -- Simulation traces are generated by executing code segments. p p p Net transitions that are associated with UML transitions are critical for generating simulation traces and MSCs. Such transitions are called critical transitions. Simulation trace n n A sequence of UML transitions. For each critical transition, information is recorded in terms of UML terms, such as source state, target state, triggering event, newly generated event(s).

The object page for the Master object Init /Start Waiting Statechart for Master A The object page for the Master object Init /Start Waiting Statechart for Master A code segment is defined for T 3, which is a critical transition

Simulation visualization p During simulation, view message passing between objects via Message Sequence Charts Simulation visualization p During simulation, view message passing between objects via Message Sequence Charts (MSCs).

Simulation visualization p p p A horizontal arrow – a new event is generated Simulation visualization p p p A horizontal arrow – a new event is generated and is sent from one object to another A solid rectangle – an event is received, dispatched, and triggers a transition Net transitions that are associated with UML transitions are critical for generating MSCs. Such transitions are called critical transitions. We define a code segment for each critical transition to generate MSCs n p Design/CPN provides an ML library for generating the components of MSCs. A code segment is executed each time the associated net transition fires.

Algorithm for generating MSCs p p p p p foreach t CT(obj) do if Algorithm for generating MSCs p p p p p foreach t CT(obj) do if consume(t, e 1) and generate(t, receiver_obj, e 2) then generate a code segment that contains the following two function calls: c 1(obj, e 1); c 2(obj, receiver_obj, e 2); else if consume(t, e 1) then generate a code segment that contains the following function call: c 1(obj, e 1); else if generate(t, receiver_obj, e 2) then generate a code segment that contains the following function call: c 2(obj, receiver_obj, e 2); endif enddo

View control p What is the idea of view control? n As a means View control p What is the idea of view control? n As a means to control the complexity of systems analysis, enable designers to view systems at different levels of abstraction.

View control p Motivation n p Enable designers to be able to reason about View control p Motivation n p Enable designers to be able to reason about the behavior of a subset of the objects or the occurrences of some particular events Methodology n n n Define filters to tailor the views for the system behavior Object filter Event filter

An example of view control – using an event filter Events Button. Pushed, Energize, An example of view control – using an event filter Events Button. Pushed, Energize, and Deenergize are selected

An example of view control – using object filter An example of view control – using object filter

Implementation of view control p p p p p foreach t CT(obj) do if Implementation of view control p p p p p foreach t CT(obj) do if consume(t, e 1) and generate(t, receiver_obj, e 2) then generate a code segment that contains the following two function calls: c 1(obj, e 1); c 2(obj, receiver_obj, e 2); else if consume(t, e 1) then generate a code segment that contains the following function call: c 1(obj, e 1); else if generate(t, receiver_obj, e 2) then generate a code segment that contains the following function call: c 2(obj, receiver_obj, e 2); endif enddo

Implementation of view control include an interface for inputting view control info p p Implementation of view control include an interface for inputting view control info p p Code segments supports recording information in the MSC regenerating the target model when changing the view p To avoid model regeneration, flags are defined for each object and event to introduce control in the code segments and parameterize the target model p A communication mechanism between the conversion tool and the Design/CPN tool – COMMS/CPN library based on TCP/IP

An example A prepaid gas station system p Suppose that we want to check An example A prepaid gas station system p Suppose that we want to check the following property: p Once the customer cancels the request for purchasing gasoline, the customer’s prepaid amount should be returned. Events of interest: Cancel and Get. Change

An example Events Cancel and Get. Change are selected An example Events Cancel and Get. Change are selected

Tool support p Automated target model generation n n p XMI file parser selfdefined Tool support p Automated target model generation n n p XMI file parser selfdefined model file Generate an abstract net model Generate the target model Output the target model to an XML file An interface for view control

Related work p v. UML (Lilius and Paltor 1999) n p Jack (Gnesi, Latella, Related work p v. UML (Lilius and Paltor 1999) n p Jack (Gnesi, Latella, and Massink, 1999) n p p The PROMELA language, SPIN model checker various formal methods techniques that includes a model checker based on branching time temporal logic Converting UML state machines into Hierarchical Predicate Transition Net, a type of colored Petri net (Dong, Fu, and He, 2003) Statechart Simulator for Modeling Architectural Dynamics (Egyed and Wile, 2001)

Future work p Extend our methodology so that it handles more sophisticated features of Future work p Extend our methodology so that it handles more sophisticated features of UML statecharts, such as composite states. p Investigate enhanced model analysis capabilities. p Investigate the integration of other UML diagrams, such as use case diagrams and sequence diagrams, in our approach to strengthen the behavioral modeling and analysis. p Evaluate effectiveness using case studies.

Comments and Questions? s! Thank Comments and Questions? s! Thank




  • Мы удаляем страницу по первому запросу с достаточным набором данных, указывающих на ваше авторство. Мы также можем оставить страницу, явно указав ваше авторство (страницы полезны всем пользователям рунета и не несут цели нарушения авторских прав). Если такой вариант возможен, пожалуйста, укажите об этом.