e CGE Enhanced Petri Net Graphical Editor A

  • Slides: 41
Download presentation
e. CGE (Enhanced Petri Net Graphical Editor) : A Multi-Platform Petri Net Editor 15

e. CGE (Enhanced Petri Net Graphical Editor) : A Multi-Platform Petri Net Editor 15 April 2005 David Dugan

Overview n n n Role of Petri Nets in software development and testing How

Overview n n n Role of Petri Nets in software development and testing How CGE implements Stochastic Petri Nets History of CGE and how e. CGE enhances capability Design of e. CGE Test Cases Future plans and conclusion

Verification of design requirements n Through formal testing or simulation of the environment •

Verification of design requirements n Through formal testing or simulation of the environment • • n Performance modeling though a special graphical language formalism • • n Very costly and time consuming Difficult to go thru all possible execution paths Difficult to simulate timing problems Does not catch problems until well into coding phase Temporal specifications for time-critical systems Probabilistic specifications to describe selection among different possible events Performance modeling through graphics

Petri Nets - Graphical Modeling of Critical Timing Applications n n Flow charts, block

Petri Nets - Graphical Modeling of Critical Timing Applications n n Flow charts, block diagrams, state diagrams do not show timing or probability of events Firing time in Petri Nets is the delay time before a transition can take place • • Immediate (Deterministic) – Fixed delay time Timed (Stochastic) – Random or asynchronous time

e. CGE Benefits n n e. CGE provides a graphical means to specify a

e. CGE Benefits n n e. CGE provides a graphical means to specify a Stochastic Petri Net Model to model the dynamic as well as static aspects Output of e. CGE can be input into the Stochastic Petri Net Package to obtain numerical results for the model using Markov analysis

e. CGE Goals n n n Model a system quickly and inexpensively Produce a

e. CGE Goals n n n Model a system quickly and inexpensively Produce a tool that does not require extensive training Be able to use the model to communicate to customers

CGE Background n n Original work by Norb Gravelle proof of concept that CSPL

CGE Background n n Original work by Norb Gravelle proof of concept that CSPL coding language can be generated from a graphical interface instead of a text editor Work by Wen Wei extended this tool to include graphical layout algorithms • • Spring Algorithm Tree Algorithm

e. CGE Components Component Language GUI Framework Design Methodology OS Supported Original CGE C++

e. CGE Components Component Language GUI Framework Design Methodology OS Supported Original CGE C++ MS Visual Studios procedural MS Windows CSPL parser C++ N/A – command line application object-oriented any C++ N/A – selected by a menu item procedural any object-oriented any supporting Java 1. 4 Spring and Tree Algorithms Enhanced CGE Java AWT / Swing

My Contribution n n Combined work by Gravelle, Wei, and CSPL parser into a

My Contribution n n Combined work by Gravelle, Wei, and CSPL parser into a single application Added parser to import CSPL files Designed the application using object-oriented analysis and design techniques for future enhancements Designed an interface for future development of graph layout algorithms Added a Random graph layout algorithm

CSPL (C Based Stochastic Petri-net language) n n Specification language for Stochastic Petri Net

CSPL (C Based Stochastic Petri-net language) n n Specification language for Stochastic Petri Net package - CSPL - can be used to specify complex system behaviors with Petri nets CSPL Conversion Process • • Reads in CSPL file to determine elements and attributes of model CGE Language adds graphical information for each model element

Enhancements to CGE I n n n Ability to read in a CSPL file

Enhancements to CGE I n n n Ability to read in a CSPL file and display it graphically Edit and display an imported CSPL file Parameters for a model are input through dialog boxes • • n Specify the properties of a place, transition, or arc Interface for defining guard function Read and save a model in CGE format

Enhancements to CGE II n n Consistency checking of parameters insures a syntactically correct

Enhancements to CGE II n n Consistency checking of parameters insures a syntactically correct model Improved maintainability of design through complete redesign of code based on object oriented design Rewrote all code in JAVA to enhance portability to other platforms Added a Random Graph Layout Algorithm

CGE Evolution First Iteration Second Iteration

CGE Evolution First Iteration Second Iteration

CGE Evolution Third Iteration Fourth Iteration

CGE Evolution Third Iteration Fourth Iteration

e. CGE Design n Redesign and integration of legacy CGE components into e. CGE

e. CGE Design n Redesign and integration of legacy CGE components into e. CGE • • • n Gravelle’s Original CGE Wen Wei Graphical Layout algorithms CSPL parser Used Object Oriented Design to integrate these components into a single application

Legacy Design Approach

Legacy Design Approach

e. CGE Classes n n High-Level Class Chart for e. CGE An appendix in

e. CGE Classes n n High-Level Class Chart for e. CGE An appendix in thesis describes the design and implementation details • • Class charts Design and implementation details of key components

Case Studies n Case # 1 - Connected Cyclic Reliability (CCR) model for the

Case Studies n Case # 1 - Connected Cyclic Reliability (CCR) model for the anti-lock braking system • n Analyzed the mean time to failure for the braking system of a vehicle Case # 2 - How the layout affects understanding and finding problems in a Petri net model (race condition).

Case Study # 1 – CCR Model n n n Model input from CSPL

Case Study # 1 – CCR Model n n n Model input from CSPL language and translated into CGL language Layout (Spring and Tree) algorithms proved inadequate to handle the reformatting of graphical layout of a complex model e. CGE requires further enhancements to resolve the layout of complex models, as shown in the following figures.

Layout using Random Algorithm Method n Applying the Random Algorithm results in this arrangement.

Layout using Random Algorithm Method n Applying the Random Algorithm results in this arrangement.

Layout using Manual Methods n Manually laying out the elements provides a more readable

Layout using Manual Methods n Manually laying out the elements provides a more readable layout.

Case Study 2 n n The use of layout is important in understanding the

Case Study 2 n n The use of layout is important in understanding the structure of a model and detecting potential problems Types of possible problems: • • Conflict Confusion (analogous to a race condition)

Example of how a race condition “conflict” can be in Petri Net n n

Example of how a race condition “conflict” can be in Petri Net n n p = places, t = transitions, 1 = tokens Figures 3 a and 3 b represent confusion as to which path program will take based on which token fires first

CSPL Code for prior example of conflict (race condition) n n The following segment

CSPL Code for prior example of conflict (race condition) n n The following segment shows the equivalent CSPL code for the previous example The textual version shows the elements, but not the graphical structure, of the model

Future Enhancements of e. CGE n n n Enhance graph layout algorithms to handle

Future Enhancements of e. CGE n n n Enhance graph layout algorithms to handle more complex structures Be able to import and translate other Petri Net modeling tools file formats Add a scroll bar to document window to increase work space Be able to group elements to move them Incorporate an algorithm to minimize arc crossings (such as the various graphviz layout algorithms, see http: //www. graphviz. org/ )

Conclusions I n e. CGE has integrated a number of separate programs which represent

Conclusions I n e. CGE has integrated a number of separate programs which represent a foundation for using Stochastic Petri Nets in industry • • Mechanizing and simplifying the development of a model by using a graphical, rather than textual, interface Being able to visualize time critical events via the Petri net diagrammatic language using e. CGE facilities and layout algorithms § Including visualization of a large library of legacy (textually based) CSPL models

Conclusions II n n Increased maintainability of the code using object-oriented design makes it

Conclusions II n n Increased maintainability of the code using object-oriented design makes it easier to further enhance the application Made programs/components of CGE platform independent through use of JAVA to encourage usage on a variety of platforms

Questions & Answer Session Mr. Dugan has a severe speaking disability (WSU has certified)

Questions & Answer Session Mr. Dugan has a severe speaking disability (WSU has certified) and for the purposes of the defense we asked him to write the answers to the committee’s questions.

Ordinary Petri Net n A biparte graph that consists of • • • n

Ordinary Petri Net n A biparte graph that consists of • • • n A set of Places A set of Transitions A set of directed Arcs connect Places to Transitions • • Input Arc - Directed Arc from Place to Transition Output Arc - Directed Arc from Transition to Place

Ordinary Petri Net Formal Definition n n PN = (P, T, A) P= {p

Ordinary Petri Net Formal Definition n n PN = (P, T, A) P= {p 1, p 2, …. p(n)} T= {t 1, t 2, …. t(m)} A = {a 1, a 2, …, a(o)} - arcs

Generalized Stochastic Petri Net (GSPN) n n Time is associated with Transitions are immediate

Generalized Stochastic Petri Net (GSPN) n n Time is associated with Transitions are immediate and timed • • • Immediate - Fire immediately when enabled and the logical structure is modeled, but not the timing Timed -Fire after a random, exponentially distributed enabling time Example of timed - A finite time delay until a hardware device is ready to accept the command before issuing it Timed - Used with devices that cannot respond at the program execution rate Example of Immediate - Usual case in programming where transitions are made at the same rate as program execution

Markings • • • Tangible - Only timed transitions are enabled in a marking

Markings • • • Tangible - Only timed transitions are enabled in a marking Vanishing - At least one immediate transition is enabled in a marking. May be removed in the analysis to reduce time and space complexity Absorbing § § § Applies to a place which has no output Arcs Transition firing adds a token to this place However, the token can no longer be used to enable a transition

Consistency Checking n Drawing Window • • n Shows an error message for an

Consistency Checking n Drawing Window • • n Shows an error message for an illegal operation For example, conecting a place to a place Dialogue Boxes • • Grays out boxes or input fields(allows operator no input) if operation is illegal or undefined Example - Transition Dialogue Box cannot have a Guard Function if no functions have been defined

Spring Algorithm n Places and transitions are like weights on springs n Starts from

Spring Algorithm n Places and transitions are like weights on springs n Starts from the first arc n Simulates a mechanical system consisting of springs (arcs) and nodes (places and transitions). From the initial configuration or ring positions, the system oscillates until it stabilizes at a minimum-energy configuration. It has been noted that in such a configuration, all the edges typically have relatively uniform length and nodes not connected tend to be far apart.

Tree Algorithm n The goal of this algorithm is to produce a graph that

Tree Algorithm n The goal of this algorithm is to produce a graph that is planar, straight-lined, and upward (that is, a ‘parent’ node is above its ‘children’). Vertices at the same level are horizontally aligned. The first place in the place list is chosen to be the root of the tree. • • • The space (vertical distance) between each level is uniform. The separation distance between two consecutive vertices on the same level is kept to a minimum. The overall width of the graph is as small as possible and still be readable.

Other ways of laying out graphs n Reference Article: Empirical Layout of Aesthetics-based Graph

Other ways of laying out graphs n Reference Article: Empirical Layout of Aesthetics-based Graph Layout by Purchase, Carrington, and Allder • • n Planar Grid Drawing Algorithm Force Directed Algorithm Goals of Graph layout program • • Minimize edge crossings Orthogonality Information Flow (connected nodes should be close together) Minimize edge bends

Weaknesses of Graphical Approaches n n n Reference Article: Empirical Layout of Aesthetics-based Graph

Weaknesses of Graphical Approaches n n n Reference Article: Empirical Layout of Aesthetics-based Graph Layout by Purchase, Carrington, and Allder No one type of layout works for every graph Graph layout requires a significant computational power History of the flow chart How to show a large graph in a drawing window: • • Add scroll bars Re-size the model (zoom in and out)

Understanding n n A graphical representation of a Petri Net tends to be at

Understanding n n A graphical representation of a Petri Net tends to be at a higher level of abstraction than a textual representation affects response time Easier to see errors Shows the structure of the model

Extensibility n n Interface for graph layout algorihm described in section A. 3 of

Extensibility n n Interface for graph layout algorihm described in section A. 3 of thesis Adding a graph layout algorithms requires the following steps: • • • Create a new subroutine containing the implementation (class document_class) Add a new menu item in the Algorithms menu bar (class algorithms_menu) Add code so that when the menu item is selected, the correct subroutine is called (affects classes document_manager, document_internal_frame, and document_panel)

Ease of Use n Goal is to minimize the amount of effort required to

Ease of Use n Goal is to minimize the amount of effort required to use the tool such as • • Minimizing keystrokes Logically organizing the layout of dialog boxes

OO Design Maintainability n n n The system architecture uses fine grained, self contained

OO Design Maintainability n n n The system architecture uses fine grained, self contained components that can readily be changed Avoids shared data structures and global variables (minimizes data coupling) Each class is self-contained - all relevant operations and data are contained within the class