towards a high-level petri net type definitionworkshop on interchange formats for petri nets 1/18...

19
June 26, 2004 Towards a High-Level Petri Net Type Definition Workshop on Interchange Formats for Petri Nets 1/18 Towards a High-Level Petri Net Type Definition Michael Westergaard Department of Computer Science University of Aarhus Denmark

Upload: mariah-greer

Post on 16-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

1/18

Towards aHigh-Level Petri Net Type Definition

Michael WestergaardDepartment of Computer Science

University of AarhusDenmark

Page 2: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

2/18

Difficulties

• Labels are not just non-negative integers, but can range over an arbitrary domain – is “1`2++4`7” the same as “<2>+4*<7>”?

• High-level Petri nets (HLPN) often support elaborate composition mechanisms, which have to be dealt with – should we extend PNML to support hierarchical nets?

Page 3: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

3/18

Outline

• Labels• Composition Constructs

– Hierarchical Petri Nets– Fusion

• Implementation Status

Page 4: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

4/18

Labels• We have identified the following labels

for high-level Petri nets:– (Names,)– Declarations (of types and variables),– Place types,– Initial markings,– Arc inscriptions, and– Transition guards.

• To support interchange, we have defined structures for:– Identifiers (for names, declarations, and place

markings),– Types (for type declarations),– Multi-sets (for initial markings and arc inscriptions), and– Expressions.

Page 5: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

5/18

Labels

• Take as example a net witha place named A withdomain INT and initialmarking one token withvalue 2 and four tokenswith value 7

• We notice1) Two (three) new labels, the domain, the initial

marking (and the name)2) The initial marking is rather complex, and several

reasonable concrete syntaxes can express it, e.g.• CPN Tools: 1`2++4`7• CPN-AMI: <2> + 4*<7>

Page 6: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

6/18

Labels – Solution 1:Store as Concrete Syntax

Example• We would store the initial marking as follows

(using the concrete syntax of CPN Tools):<initialMarking> <text>1`2++4`7</text></initialMarking>

Advantage• Very simple approach; high-level labels are a direct

generalization of low-level labels

Disadvantage• Different tools use different syntaxes to express the

same– CPN Tools: 1`2++4`7, or– CPN-AMI: <2> + 4*<7>.and this makes interchange difficult

Page 7: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

7/18

Labels – Solution 2:Store as Abstract Syntax Tree

Example• We would store the initial marking as follows:

<initialMarking> <multiset> <value cardinality=”1”><text>2</text></value> <value cardinality=”4”><text>7</text></value> </multiset></initialMarking>

Advantage• Eliminates differences in concrete syntax

Disadvantages• Difficult to make simple editors that do not

completely parse and check inscriptions• Cumbersome to add new features, as a new AST

node has to be defined

Page 8: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

8/18

Labels – Solution 3:Mix Abstract and Concrete Syntax

Example• We would allowing the initial marking to be

stored as either:<initialMarking> <text>1`2++4`7</text></initialMarking>

or<initialMarking> <multiset> <value cardinality=”1”><text>2</text></value> <value cardinality=”4”><text>7</text></value> </multiset></initialMarking>

Advantages• Tools can save as much or as little using abstract syntax

as desired – trade-off between interchangeability and simplicity

• New features can easily be incorporated by using concrete syntax until an appropriate AST node is defined

Page 9: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

9/18

Labels – Solution 3:Mix Abstract and Concrete Syntax

Added benefits• Allows an incremental transition to the

interchange format, as tool implementers can choose to save only some (parts of) labels as ASTs

• Allows the format to be used as primary storageformat, as incorrect (and therefore unparsable) inscriptions can be saved using concrete syntax

Page 10: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

10/18

Composition Constructs

• A number of composition constructsexist for high-level Petri nets:– Hierarchical nets– Fusion places– Synchronous channels– etc.

• Composition mechanisms can be represented by adding new labels or special nodes– Example: Fusion places can be implemented by

adding a label fusionGroup, which indicates to what fusion group the place belongs

Page 11: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

11/18

Composition Constructs

• If we implement the compositionconstructs by a translation toModular PNML, they will be availableto a wider range of tools– Tools only need to support Modular PNML, and

we need not clutter the standard with more or less useful improvements

– Modular PNML can be mechanically flattened to Basic PNML, so support for Modular PNML is not essential

– Expressed like this, the composition mechanisms are no longer tied to high-level Petri nets

Page 12: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

12/18

Fusion Places:Canonical Member

Page: Producer

Page: Consumer

A• If a tool does not know

about fusion places, how do we easily remove the place B from the fusion group?

• What happens if we have more than one instance of the Consumer-page?

Select one member and convert it to a normal placeSelect one member and convert it to a normal place

Make all other members point to the selected place

Select one member and convert it to a normal place

Make all other members point to the selected place

Page 13: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

13/18

Create a new page with a new place

Fusion Places:Create a New Global Place

Page: Producer

Page: Consumer

Page: Storage

Storage

1`2++4`7

INT

B

A Create a new page with a new place

Make all the members point to it

Create a new page with a new place

Make all the members point to it

• Deletion is now easy: just do it

• It is easy to add a place to or remove a place from the group: just update the pointer

• Multiple instances just amount to multiple pointers, which is fine

Create a new page with a new place

Make all the members point to it

Page 14: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

14/18

Hierarchical Petri Nets

Page: Produce/Consume Page: Counted transmitModule: Counted transmit

A B

A B

Counted transmit

System

Receiver

Network

Sender

Router

Media

Convert the sub-page to a moduleConvert the sub-page to a module

Move all port-places to the interface

Convert the sub-page to a module

Move all port-places to the interface

Convert the substitution-transition to an instance of the module

Convert the sub-page to a module

Move all port-places to the interface

Convert the substitution-transition to an instance of the module

Page 15: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

15/18

Implementation Status• A preliminary PNTD for high-level Petri

nets is written• A transformation from PT-nets to the

proposed format has been written• A transformation from the current storage-

format of CPN Tools to the proposed format has been written

• A tool for composition of high-level Petri nets stored using the proposed format is written

All is available from http://www.daimi.au.dk/~mw/local/pnml/.

(the address is also in the paper)

Page 16: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

16/18

Conclusion• We have shown 3 different ways to

represent labels:1) using concrete syntax only,2) using abstract syntax only, and3) using a mixture of concrete and abstract syntax.

• We have argued that the 3rd way is the best, as it is more flexible and allows interchange between tools not sharing concrete syntax

• We have seen reasonable ways to translate common composition mechanisms to Modular PNML equivalents, in particular:1) Hierarchical Petri nets and2) Fusion Places.

System

Receiver

Network

Sender

Router

Media

Page 17: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

17/18

Difficulties Revisited

• Labels are not just non-negative integers, but can range over an arbitrary domain – is “1`2++4`7” the same as “<2>+4*<7>”? Yes, store them as abstract syntax.

• High-level Petri nets (HLPN) often support elaborate composition mechanisms, which have to be dealt with – should we extend PNML to support hierarchical nets? No, convert them to use Modular PNML.

Page 18: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

18/18

Future Work

• Definition of AST nodes for more functions in expressions, such as– arithmetical operators– string operations

• Division of expressions into reasonable chunks (suitable for e.g. well-formed nets and general coloured Petri nets)

Page 19: Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition

June 26, 2004

Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets

19/18

Labels – Solution 3:Mix Abstract and Concrete Syntax

Not a clear-cut separation• E. Kindler proposes in the April 2004

proposal for ISO/IEC 15909-2 a similarapproach to the representation labels

• Kindlers proposal requires that a label is stored either using concrete syntax or using abstract syntax

• Our proposal allows<declaration> <type> <name>PRIME</name> <type><text>prime</text></type> </type></declaration>

which clearly is a type-declaration even though the type “prime” is not standardized

• Thus not having a clear-cut separation of abstract and concrete syntax makes it easy to simulate new AST nodes