ecge (enhanced petri net graphical editor) : a multi-platform petri net editor 15 april 2005 david...
TRANSCRIPT
eCGE (Enhanced PetrieCGE (Enhanced PetriNet Graphical Editor) : Net Graphical Editor) : A Multi-Platform Petri A Multi-Platform Petri
Net EditorNet Editor
15 April 200515 April 2005
David DuganDavid Dugan
OverviewOverview
Role of Petri Nets in software Role of Petri Nets in software development and testingdevelopment and testing
How CGE implements Stochastic Petri How CGE implements Stochastic Petri NetsNets
History of CGE and how eCGE enhances History of CGE and how eCGE enhances capabilitycapability
Design of eCGEDesign of eCGE Test CasesTest Cases Future plans and conclusionFuture plans and conclusion
Verification of design Verification of design requirementsrequirements
Through formal testing or simulation of Through formal testing or simulation of the environmentthe environment• Very costly and time consumingVery costly and time consuming• Difficult to go thru all possible execution Difficult to go thru all possible execution pathspaths
• Difficult to simulate timing problems Difficult to simulate timing problems • Does not catch problems until well into coding Does not catch problems until well into coding phasephase
Performance modeling though a special Performance modeling though a special graphical language formalismgraphical language formalism• Temporal specifications for time-critical Temporal specifications for time-critical systemssystems
• Probabilistic specifications to describe Probabilistic specifications to describe selection among different possible eventsselection among different possible events
Performance modeling through graphicsPerformance modeling through graphics
Petri Nets - Graphical Petri Nets - Graphical Modeling of Critical Modeling of Critical Timing ApplicationsTiming Applications
Flow charts, block diagrams, state Flow charts, block diagrams, state diagrams do not show timing or diagrams do not show timing or probability of eventsprobability of events
Firing time in Petri Nets is the Firing time in Petri Nets is the delay time before a transition can delay time before a transition can take placetake place• Immediate (Deterministic) – Fixed delay Immediate (Deterministic) – Fixed delay timetime
• Timed (Stochastic) – Random or Timed (Stochastic) – Random or asynchronous time asynchronous time
eCGE BenefitseCGE Benefits
eCGE provides a graphical means eCGE provides a graphical means to specify a Stochastic Petri Net to specify a Stochastic Petri Net Model to model the dynamic as Model to model the dynamic as well as static aspectswell as static aspects
Output of eCGE can be input into Output of eCGE can be input into the Stochastic Petri Net Package the Stochastic Petri Net Package to obtain numerical results for to obtain numerical results for the model using Markov analysis the model using Markov analysis
eCGE GoalseCGE Goals
Model a system quickly and Model a system quickly and inexpensivelyinexpensively
Produce a tool that does not Produce a tool that does not require extensive trainingrequire extensive training
Be able to use the model to Be able to use the model to communicate to customers communicate to customers
CGE BackgroundCGE Background
Original work by Norb Gravelle Original work by Norb Gravelle proof of concept that CSPL coding proof of concept that CSPL coding language can be generated from a language can be generated from a graphical interface instead of a graphical interface instead of a text editortext editor
Work by Wen Wei extended this tool Work by Wen Wei extended this tool to include graphical layout to include graphical layout algorithmsalgorithms• Spring AlgorithmSpring Algorithm• Tree AlgorithmTree Algorithm
eCGE ComponentseCGE Components
ComponentComponent LanguageLanguage GUI GUI FrameworkFramework
Design Design MethodologyMethodology
OS SupportedOS Supported
Original CGEOriginal CGE C++C++ MS Visual MS Visual StudiosStudios
proceduralprocedural MS WindowsMS Windows
CSPL parserCSPL parser C++C++ N/A – command N/A – command line line
applicationapplication
object-orientedobject-oriented anyany
Spring and Spring and Tree Tree
AlgorithmsAlgorithms
C++C++ N/A – selected N/A – selected by a menu by a menu
itemitem
proceduralprocedural anyany
Enhanced CGEEnhanced CGE JavaJava AWT / SwingAWT / Swing object-orientedobject-oriented any supporting any supporting Java 1.4Java 1.4
My ContributionMy Contribution
Combined work by Gravelle, Wei, and Combined work by Gravelle, Wei, and CSPL parser into a single applicationCSPL parser into a single application
Added parser to import CSPL filesAdded parser to import CSPL files Designed the application using Designed the application using object-oriented analysis and design object-oriented analysis and design techniques for future enhancementstechniques for future enhancements
Designed an interface for future Designed an interface for future development of graph layout development of graph layout algorithmsalgorithms
Added a Random graph layout algorithmAdded a Random graph layout algorithm
CSPL (C Based Stochastic CSPL (C Based Stochastic Petri-net language)Petri-net language)
Specification language for Specification language for Stochastic Petri Net package - Stochastic Petri Net package - CSPL - can be used to specify CSPL - can be used to specify complex system behaviors with complex system behaviors with Petri netsPetri nets
CSPL Conversion ProcessCSPL Conversion Process• Reads in CSPL file to determine Reads in CSPL file to determine elements and attributes of modelelements and attributes of model
• CGE Language adds graphical CGE Language adds graphical information for each model elementinformation for each model element
Enhancements to CGE IEnhancements to CGE I
Ability to read in a CSPL file and Ability to read in a CSPL file and display it graphicallydisplay it graphically
Edit and display an imported CSPL Edit and display an imported CSPL filefile
Parameters for a model are input Parameters for a model are input through dialog boxesthrough dialog boxes• Specify the properties of a place, Specify the properties of a place, transition, or arctransition, or arc
• Interface for defining guard function Interface for defining guard function Read and save a model in CGE formatRead and save a model in CGE format
Enhancements to CGE IIEnhancements to CGE II
Consistency checking of parameters Consistency checking of parameters insures a syntactically correct modelinsures a syntactically correct model
Improved maintainability of design Improved maintainability of design through complete redesign of code through complete redesign of code based on object oriented designbased on object oriented design
Rewrote all code in JAVA to enhance Rewrote all code in JAVA to enhance portability to other platformsportability to other platforms
Added a Random Graph Layout AlgorithmAdded a Random Graph Layout Algorithm
CGE EvolutionCGE Evolution
First Iteration Second Iteration
develop Petri net model
(original CGE)
CSPL file
save as
numerical analysis
package (SPNP)
analyze results
develop Petri net model (original CGE)
CSPL file
save as
numerical analysis
package (SPNP)
analyze results
open as
CGE file
save as
CGE EvolutionCGE Evolution
Third Iteration Fourth Iteration
develop Petri net model (original CGE)
CSPL file
save as
numerical analysis
package (SPNP)
analyze results
open as
CGE file
save asrun
graph layout
algorithm
update
display
develop Petri net model (original CGE)
CSPL file
save as
numerical analysis
package (SPNP)
analyze results
open as
CGE file
save as run
graph layout
algorithm
(improved
interface)
update
display
open
eCGE DesigneCGE Design
Redesign and integration of Redesign and integration of legacy CGE components into eCGElegacy CGE components into eCGE• Gravelle’s Original CGEGravelle’s Original CGE• Wen Wei Graphical Layout algorithmsWen Wei Graphical Layout algorithms• CSPL parserCSPL parser
Used Object Oriented Design to Used Object Oriented Design to integrate these components into integrate these components into a single applicationa single application
Legacy Design ApproachLegacy Design Approachstudy existing
design
one component
of the design
create/modify
abstract model
design prototype
of abstract model
functional
verification
design
validation
integrate design
/ prototype into
overall system
no : implementation
problem
no : design
problem
yes
yes
start
eCGE ClasseseCGE Classes
High-Level Class Chart for eCGEHigh-Level Class Chart for eCGE An appendix in the thesis describes the design and implementation detailsAn appendix in the thesis describes the design and implementation details
• Class chartsClass charts• Design and implementation details of key componentsDesign and implementation details of key components
cge_app
menu bars
multiple document prototype
document class
list classes
guard functions dialog box
CSPL parameters dialog box
CSPL parser
mouse class
mouse event parser
mouse handler
Case StudiesCase Studies
Case # 1 - Connected Cyclic Case # 1 - Connected Cyclic Reliability (CCR) model for the Reliability (CCR) model for the anti-lock braking system anti-lock braking system • Analyzed the mean time to failure for Analyzed the mean time to failure for the braking system of a vehiclethe braking system of a vehicle
Case # 2 - How the layout affects Case # 2 - How the layout affects understanding and finding problems understanding and finding problems in a Petri net model (race in a Petri net model (race condition).condition).
Case Study # 1 – CCR Case Study # 1 – CCR ModelModel
Model input from CSPL language Model input from CSPL language and translated into CGL languageand translated into CGL language
Layout (Spring and Tree) Layout (Spring and Tree) algorithms proved inadequate to algorithms proved inadequate to handle the reformatting of handle the reformatting of graphical layout of a complex graphical layout of a complex modelmodel
eCGE requires further eCGE requires further enhancements to resolve the enhancements to resolve the layout of complex models, as layout of complex models, as shown in the following figures.shown in the following figures.
Layout using Random Algorithm Method
Applying the Random Algorithm results in Applying the Random Algorithm results in this arrangement.this arrangement.
Layout using Manual Methods
Manually laying out the elements Manually laying out the elements provides a more readable layout.provides a more readable layout.
Case Study 2Case Study 2 The use of layout is important in The use of layout is important in understanding the structure of a understanding the structure of a model and detecting potential model and detecting potential problemsproblems
Types of possible problems:Types of possible problems:• ConflictConflict• Confusion (analogous to a race Confusion (analogous to a race condition)condition)
Example of how a race Example of how a race condition “conflict” can condition “conflict” can
be in Petri Net be in Petri Net p = places, t = transitions, 1 = p = places, t = transitions, 1 = tokenstokens
Figures 3a and 3b represent Figures 3a and 3b represent confusion as to which path program confusion as to which path program will take based on which token fires will take based on which token fires firstfirst1 p 1
t 1
p 2 p 3 p 4
p 5 p 6
t 2 t 3
11
p 1
t 1
p 2 p 3 p 4
p 5 p 6
t 2 t 3
111
1. initial marking 2. marking after t 1 fires
1
p 1
t 1
p 2 p 3 p 4
p 5 p 6
t 2 t 3
1
p 1
t 1
p 2 p 3 p 4
p 5 p 6
t 2 t 3
1
1
3a. marking after t 2 fires 3b. marking after t 3 fires
CSPL Code for prior CSPL Code for prior example of conflict example of conflict (race condition)(race condition)
The following segment shows the equivalent The following segment shows the equivalent CSPL code for the previous exampleCSPL code for the previous example
The textual version shows the elements, The textual version shows the elements, but not the graphical structure, of the but not the graphical structure, of the modelmodel
place(“p1”);init(“p1”, 1);place(“p2”);place(“p3”);init(“p3”, 1);place(“p4”);init(“p4”, 1);place(“p5”);place(“p6”);
rateval(“t1”, 1.0);rateval(“t2”, 1.0);rateval(“t3”, 1.0);
iarc(“p1”,”t1”);iarc(“p2”,”t2”);iarc(“p3”,”t2”);iarc(“p3”,”t2”);iarc(“p4”,”t3”);
oarc(“p2”,”t2”);oarc(“p5”,”t2”);oarc(“p6”,”t3”);
Future Enhancements of Future Enhancements of eCGEeCGE
Enhance graph layout algorithms to handle Enhance graph layout algorithms to handle more complex structuresmore complex structures
Be able to import and translate other Be able to import and translate other Petri Net modeling tools file formatsPetri Net modeling tools file formats
Add a scroll bar to document window to Add a scroll bar to document window to increase work spaceincrease work space
Be able to group elements to move themBe able to group elements to move them Incorporate an algorithm to minimize arc Incorporate an algorithm to minimize arc crossings (such as the various crossings (such as the various graphvizgraphviz layout algorithms, see layout algorithms, see http://www.graphviz.org/ )http://www.graphviz.org/ )
Conclusions IConclusions I eCGE has integrated a number of eCGE has integrated a number of separate programs which represent separate programs which represent a foundation for using Stochastic a foundation for using Stochastic Petri Nets in industryPetri Nets in industry• Mechanizing and simplifying the Mechanizing and simplifying the development of a model by using a development of a model by using a graphical, rather than textual, graphical, rather than textual, interfaceinterface
• Being able to visualize time critical Being able to visualize time critical events via the Petri net diagrammatic events via the Petri net diagrammatic language using eCGE facilities and language using eCGE facilities and layout algorithms layout algorithms
Including visualization of a large Including visualization of a large library of legacy (textually based) CSPL library of legacy (textually based) CSPL modelsmodels
Conclusions IIConclusions II
Increased maintainability of the Increased maintainability of the code using object-oriented design code using object-oriented design makes it easier to further enhance makes it easier to further enhance the application the application
Made programs/components of CGE Made programs/components of CGE platform independent through use of platform independent through use of JAVA to encourage usage on a variety JAVA to encourage usage on a variety of platforms of platforms
Questions & Answer Questions & Answer SessionSession
Mr. Dugan has a severe Mr. Dugan has a severe speaking disability (WSU speaking disability (WSU has certified) and for has certified) and for the purposes of the the purposes of the
defense we asked him to defense we asked him to write the answers to the write the answers to the committee’s questions.committee’s questions.
Ordinary Petri NetOrdinary Petri Net
A biparte graph that consists ofA biparte graph that consists of• A set of PlacesA set of Places• A set of TransitionsA set of Transitions• A set of directed ArcsA set of directed Arcs
Arcs connect Places to TransitionsArcs connect Places to Transitions• Input Arc - Directed Arc from Place to Input Arc - Directed Arc from Place to TransitionTransition
• Output Arc - Directed Arc from Output Arc - Directed Arc from Transition to PlaceTransition to Place
Ordinary Petri Net Ordinary Petri Net Formal DefinitionFormal Definition
PN = (P,T,A)PN = (P,T,A) P= {p1, p2,….p(n)}P= {p1, p2,….p(n)} T= {t1,t2,….t(m)}T= {t1,t2,….t(m)} A = {a1, a2, …, a(o)} - arcsA = {a1, a2, …, a(o)} - arcs
Generalized Stochastic Generalized Stochastic Petri Net (GSPN)Petri Net (GSPN)
Time is associated with TransitionTime is associated with Transition Transitions are immediate and timedTransitions are immediate and timed
• Immediate - Fire immediately when enabled and the Immediate - Fire immediately when enabled and the logical structure is modeled, but not the timinglogical structure is modeled, but not the timing
• Timed -Fire after a random,exponentially distributed Timed -Fire after a random,exponentially distributed enabling timeenabling time
• Example of timed - A finite time delay until a Example of timed - A finite time delay until a hardware device is ready to accept the command before hardware device is ready to accept the command before issuing itissuing it
• Timed - Used with devices that cannot respond at the Timed - Used with devices that cannot respond at the program execution rateprogram execution rate
• Example of Immediate - Usual case in programming Example of Immediate - Usual case in programming where transitions are made at the same rate as where transitions are made at the same rate as program executionprogram execution
MarkingsMarkings
• Tangible - Only timed transitions Tangible - Only timed transitions are enabled in a markingare enabled in a marking
• Vanishing - At least one immediate Vanishing - At least one immediate transition is enabled in a marking. transition is enabled in a marking. May be removed in the analysis to May be removed in the analysis to reduce time and space complexityreduce time and space complexity
• Absorbing Absorbing Applies to a place which has no output Applies to a place which has no output ArcsArcs
Transition firing adds a token to this Transition firing adds a token to this placeplace
However, the token can no longer be However, the token can no longer be used to enable a transitionused to enable a transition
Consistency CheckingConsistency Checking
Drawing WindowDrawing Window• Shows an error message for an illegal operationShows an error message for an illegal operation• For example, conecting a place to a placeFor example, conecting a place to a place
Dialogue BoxesDialogue Boxes• Grays out boxes or input fields(allows operator Grays out boxes or input fields(allows operator no input) if operation is illegal or undefinedno input) if operation is illegal or undefined
• Example - Transition Dialogue Box cannot have a Example - Transition Dialogue Box cannot have a Guard Function if no functions have been Guard Function if no functions have been defined defined
Spring AlgorithmSpring Algorithm
Places and transitions are like weights on Places and transitions are like weights on springssprings
Starts from the first arcStarts from the first arc Simulates a mechanical system consisting of Simulates a mechanical system consisting of springs (arcs) and nodes (places and springs (arcs) and nodes (places and transitions). From the initial configuration transitions). From the initial configuration or ring positions, the system oscillates or ring positions, the system oscillates until it stabilizes at a minimum-energy until it stabilizes at a minimum-energy configuration. It has been noted that in configuration. It has been noted that in such a configuration, all the edges typically such a configuration, all the edges typically have relatively uniform length and nodes not have relatively uniform length and nodes not connected tend to be far apart.connected tend to be far apart.
Tree AlgorithmTree Algorithm
The goal of this algorithm is to produce a The goal of this algorithm is to produce a graph that is planar, straight-lined, and graph that is planar, straight-lined, and upward (that is, a ‘parent’ node is above its upward (that is, a ‘parent’ node is above its ‘children’). Vertices at the same level are ‘children’). Vertices at the same level are horizontally aligned. The first place in the horizontally aligned. The first place in the place list is chosen to be the root of the place list is chosen to be the root of the tree. tree. • The space (vertical distance) between each The space (vertical distance) between each
level is uniform.level is uniform.• The separation distance between two consecutive The separation distance between two consecutive
vertices on the same level is kept to a minimum.vertices on the same level is kept to a minimum.• The overall width of the graph is as small as The overall width of the graph is as small as
possible and still be readable.possible and still be readable.
Other ways of laying Other ways of laying out graphsout graphs
Reference Article: Empirical Layout of Reference Article: Empirical Layout of Aesthetics-based Graph Layout by Purchase, Aesthetics-based Graph Layout by Purchase, Carrington, and AllderCarrington, and Allder• Planar Grid Drawing AlgorithmPlanar Grid Drawing Algorithm• Force Directed AlgorithmForce Directed Algorithm
Goals of Graph layout program Goals of Graph layout program • Minimize edge crossingsMinimize edge crossings• OrthogonalityOrthogonality• Information Flow (connected nodes should be Information Flow (connected nodes should be close together)close together)
• Minimize edge bendsMinimize edge bends
Weaknesses of Graphical Weaknesses of Graphical ApproachesApproaches
Reference Article: Empirical Layout of Aesthetics-based Reference Article: Empirical Layout of Aesthetics-based Graph Layout by Purchase, Carrington, and AllderGraph Layout by Purchase, Carrington, and Allder
No one type of layout works for every graphNo one type of layout works for every graph Graph layout requires a significant computational powerGraph layout requires a significant computational power History of the flow chartHistory of the flow chart How to show a large graph in a drawing window:How to show a large graph in a drawing window:
• Add scroll barsAdd scroll bars• Re-size the model (zoom in and out)Re-size the model (zoom in and out)
UnderstandingUnderstanding
A graphical representation of a A graphical representation of a Petri Net tends to be at a Petri Net tends to be at a higher level of abstraction than higher level of abstraction than a textual representation a textual representation
affects response timeaffects response time Easier to see errorsEasier to see errors Shows the structure of the modelShows the structure of the model
ExtensibilityExtensibility
Interface for graph layout algorihm Interface for graph layout algorihm described in section A.3 of thesisdescribed in section A.3 of thesis
Adding a graph layout algorithms requires Adding a graph layout algorithms requires the following steps:the following steps:• Create a new subroutine containing the Create a new subroutine containing the implementation (class document_class)implementation (class document_class)
• Add a new menu item in the Algorithms menu bar Add a new menu item in the Algorithms menu bar (class algorithms_menu)(class algorithms_menu)
• Add code so that when the menu item is Add code so that when the menu item is selected, the correct subroutine is called selected, the correct subroutine is called (affects classes document_manager, (affects classes document_manager, document_internal_frame, and document_panel)document_internal_frame, and document_panel)
Ease of UseEase of Use
Goal is to minimize the amount Goal is to minimize the amount of effort required to use the of effort required to use the tool such as tool such as • Minimizing keystrokesMinimizing keystrokes• Logically organizing the layout of Logically organizing the layout of dialog boxesdialog boxes
OO Design OO Design MaintainabilityMaintainability
The system architecture uses fine The system architecture uses fine grained, self contained components grained, self contained components that can readily be changedthat can readily be changed
Avoids shared data structures and Avoids shared data structures and global variables (minimizes data global variables (minimizes data coupling)coupling)
Each class is self-contained - all Each class is self-contained - all relevant operations and data are relevant operations and data are contained within the classcontained within the class