The Smalltalk Prototype
The algorithms described in section 4 of the PhD have been implemented as a prototype in smalltalk and is available here for study or experimentation. This document describes how the files and how to use then.
Installation
The prototype has been developed and tested under IBM VisualAge 4.02 on windows NT. The interface to the package uses the Transcript of the development environment. To run the prototype you need a Smalltalk development environment. There are two different ways for downloading.
With Visualage Professional the two applications ZwkExtensions and ZwkPetri may be loaded from a ENVY-library as follows:
If you do not use the ENVY-library or simply want to read the source then
Finally, there are example nets in TPN format taken from CodeSign [Ess97]. Use either the winzip-archive tpnNets.ZIP(28 KB) or select some examples from the directory tpnNets.
User Interface
The interface to the package uses the Transcript of the development environment. There is an interface classed called Petri. If the application ZwkPetri or if you execute (the class method) Petri help short instructions together with some code examples are printed to the Transcript. Simply mark a line of these instruction and execute it (ctrl e) to run the test. A simple scenario:
smalltalk statement |
effect |
Petri addNetEdwm |
creates an example net and loads is as the last member of Petri singleton |
Petri toColours |
adds different stages of analysis of the source member |
Petri printDetails |
prints the of the last member |
Petri all; printStats |
prints the statistics of all members |
Petri printDetails |
prints the details of all members |
The class Petri implements a singleton pattern. The class holds an instance Petri singleton. Every message that the class does not understand is forwarded to the singleton instance, hence Petri printDetails and Petri singleton printDetails are equivalent. An instance of Petri contains a collection (members) of members that contain a net and different stages of analysis. The method reset initialises the instance, especially it empties members. With cutToFirst all but the first members are removed and more generally cutTo: n removes all but the n first members.
printStats
prints one statistic line and printDetails the full information for each current member on the Transcript. The current member is by default the last one, however, the message all changes the current members to the set of all members and last changes it back to the last member.To start a Petri net is needed. They may be produced by the methods starting with add... E.g. addNetEdwm creates the example spare part ordering net and with addNetEdwm: different sizes of this net may be created. addNetFromPtn asks for a file name that must contain a net description in PTN-format (examples in the directory tpnNets as described above).
To do apply an analysis the by the methods starting with to... are used. The are searching for the last member that contains a net or the analysis of a net in the necessary state, if none is found they do some default analysis to obtain such a net. Then the analysis is performed and added as last member, possibly after adding intermediate results.
Crossreference to PhD
The following tables lists sections of the PhD and which instance method of Petri fires an example of the algorithm described there. The middle column tries to identify a method that represents the core of the algorithm.
section of PhD |
implementing method |
testcase (method of Petri) |
4.2.1 Forward Engineering by .... |
Net>> edwm: |
addNetEdwm |
4.2.5 The Telephone Net |
Net>> fromPtnStream |
addNetFromPtn |
4.3.1 Seed Types |
NetStructure>> createTransitionTypes |
toStructure |
4.3.2 Combining Types |
NetStructure>> createAutosEmbeddingsCombining: with: |
toCombinedTypes toCombinedLocalMonoTypes |
Expanding problematic types |
NetStructure>> newLocalMonoTypesExpandingAll: |
toExpandedProblematicTypes |
4.3.3 Classifying Nodes |
NetStructure>> equivalenceForMembership NetStructure>> membershipForTypes |
toTypeMembershipClassification |
4.3.4 Reduction ignoring neighbourhood |
NetStructure>> reductionForTypeGroupings |
toTypeMembershipReduction |
4.4 Neighbourhood reductions |
NetReduction>> mergeSearch: |
toConnectedReduction |
4.5.1 Reduction refinement |
NetReduction>> mergeSearch: |
toConnectedMembershipReduction |
NetStructure>> relationshipsCompose: |
toConnectedRelationshipsReduction |
|
4.5.2 Colouring |
NetReduction>> colourNodesForEquivalence: connections: |
toColours, toColours2 |
4.6.5 Reducing the reduction |
NetReduction>> reduceConnectedColours1to1 |
toReducedColours1to1 |
NetReduction>> reduceConnectedColours |
toReducedColours |