Projekt 1 eingereicht im Rahmen der Master Projekte im Studiengang Master of .... Also subnets can be reused in di erent locations of the net with little a ord.
Projekt 1 Jan-Uriel Lorbeer Dynamic graph drawing and conception of reconfigurable hierarchical Petri nets for ReConNet
Fakultät Technik und Informatik Studiendepartment Informatik
Faculty of Engineering and Computer Science Department of Computer Science
Jan-Uriel Lorbeer Dynamic graph drawing and conception of reconfigurable hierarchical Petri nets for ReConNet
Projekt 1 eingereicht im Rahmen der Master Projekte im Studiengang Master of Science Informatik am Department Informatik der Fakultät Technik und Informatik der Hochschule für Angewandte Wissenschaften Hamburg Betreuender Prüfer: Prof. Dr. Julia Padberg Eingereicht am: 10. May 2017
Jan-Uriel Lorbeer
Title of the paper Dynamic graph drawing and conception of reconfigurable hierarchical Petri nets for ReConNet
Keywords Reconfigurable Petri nets, hierarchical Petri nets, dynamic graph drawing Abstract Modeling modern systems comes with a lot of different challenges some of which can be eased by the use of appropriate models. Hierarchical Petri nets allow for an more abstract view and reconfigurable Petri nets can model dynamic structural adaptation. The aim of this work is to present a concept for the combination of reconfigurable Petri nets and hierarchical Petri nets. Further the integration of reconfigurable hierarchical Petri nets into a simulation tool for reconfigurable Petri nets called ReConNet is planned. To prepare for this goal ReConNet’s dynamic graph drawing algorithm is discussed and improved.
Contents 1 Introduction
1
2 Background on Petri Net Technologies 2.1 Hierarchical Petri nets . . . . . . . . 2.2 Reconfigureable Petri nets . . . . . . 2.3 ReConNet . . . . . . . . . . . . . . . 2.4 Related Work . . . . . . . . . . . . . .
. . . .
3 3 6 8 9
3 Dynamic Graph Drawing 3.1 Dynamic Graph Drawing Techniques . . . . . . . . . . . . . . . . . . . . . . . 3.2 Implemented Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 11 15
4 Concept 4.1 Hierarchical Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Rule Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Implementation Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20 20 23 27
5 Conclusion
28
iv
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
1 Introduction The development of modern systems is challenging. In particular developing systems that possess concurrency or non-determinism, because such systems can proceed in many different ways. Also many systems need to be especially fault resistant, this is often the case in systems for the transportation, security or the financial sector. To cope with these requirements of modern systems methods for debugging and testing the system design beforehand are necessary. A well known technique for system modeling is the usage of Petri nets. Petri nets provide a graphical language for constructing system models. These models can be used for simulations and to analyze the model’s properties. This allows locating possible faults in the system at earlier stages which also can decrease overall development costs. The increasing sizes of modern systems result in models becoming rather large and possibly hard to comprehend. The addition of an abstraction layer can counteract this issue. Hierarchical Petri nets use hierarchy to break down the complexity of a large model, by dividing it into a number of submodels. This helps the modeler to concentrate on a specific system part without the need to oversee the whole system. Also submodels can be reused with little afford at multiple location in the same system or even in a different system where similar components are needed. The analysis and verification of a hierarchical Petri net requires more effort than it’s counter part with no hierarchy. Although this appears to put additional stress onto the modeler the additional afford can be dealt with within the modeling tool and thus does not need to be dealt with by the modeler or analyst directly. More advanced systems that need dynamic structural adaption can be modeled using reconfigurable Petri nets, an approach for dynamic changes in Petri nets. A reconfigurable Petri net consist of a Petri net and set of rules that modify the Petri net’s structure at runtime. ReConNet [Padberg u. a. (2012)] is a modeling and simulation tool that allows the design of reconfigurable Petri nets. This work represents the first step in an attempt to combine the hierarchical Petri net type and reconfigurable Petri net type into a reconfigurable hierarchical Petri net type with the goal to deploy it into ReConNet. Reconfigurable hierarchical Petri nets combine the hierarchical Petri nets focused design of submodels and their reusability and the ability for dynamic changes
1
1 Introduction
of reconfigurable Petri nets. To allow the conjunction of these two concepts within one Petri net it’s reconfiguration rules have to be adapted to the new hierarchical structure. The hierarchical structure contains hierarchical borders between the different hierarchy layers. Thus certain limitation on the application of reconfiguration rules have to be established. In this work a concept for an appropriate hierarchical model and the set limitations for rules are given as well as preparation for the displaying of hierarchical Petri nets. Part of this preparation is finding an appropriate graph drawing algorithm to create a readable graph of the rule depended dynamically changing Petri net. This work is organized as follows: First chapter 2 will give an overview of basic concepts, ReConNet and related works concerning Petri nets. As preparation for the displaying of hierarchical Petri nets ReConNet’s dynamic graph drawing algorithm is analyzed compared to other state of the art techniques and improved, chapter 3 covers this process. Then chapter 4 elaborates conceptual decisions for the realization of reconfigurable hierarchical Petri nets. Finally a conclusion and future steps are considered in chapter 5.
2
2 Background on Petri Net Technologies In this chapter first an overview of the concepts of hierarchical Petri nets and reconfigurable Petri nets is given. Followed by an introduction to ReConNet. Finally related works will be briefly discussed.
2.1 Hierarchical Petri nets Hierarchical Petri nets (HPN) extend Petri nets by hierarchical layering. The addition of a hierarchy brings abstraction which results in more clarity and allows the modeler to concentrate on only a few details at a time. Also subnets can be reused in different locations of the net with little afford. Any hierarchical Petri net can be flattened. A process in which the hierarchy of the Petri net is removed. The result is a normal Petri net which behaves exactly like the hierarchical Petri net. The flattening process is different for each hierarchical Petri net type. There are two mayor techniques of hierarchical Petri nets. Transition substitution substitutes transitions with subnets and place substitution substitutes places with subnets. An other approach for hierarchic layering is the usage of Object-Oriented Petri nets (OOPN ). Currently there exist various sorts of OOPN, Miyamoto und Kumagai (2005) presents a survey of the most common ones. In it’s basic form an OOPN is composed of a system net and it’s tokens. Each token represents either a trivial object (e.g., a number or a string) or an object net instance of some class. Every class consists of an object net and a set of dynamically instantiable method nets which structure the models the inner behavior. Tokens move from one place to another calling methods and chanigng attributes. So each token to consist of one instance of the appropriate object net and several concurrently running instances of invoked method nets. Koci u. a. (2008) The purpose is to use object oriented constructs to structure and build the system.
Transition Substitution Technique For a transition substitution first a transition to substitute has to be chosen. Each place with an edge to or from the transition is considered a socket place. Than a subnet is created for
3
2 Background on Petri Net Technologies said transition. For each socket place a port places is created within the subnet, with each port place mirroring its corresponding socket place. So socket places and the corresponding port places always have the same tokens on them. If one or more tokens are added or removed from a port place the same tokens are also added or removed from the corresponding socket place and vice versa. Through these places tokens enter and leave the subnet. During each simulation step one transition can fire, the firing transition can be from either the main net or any subnet. Any net can contain multiple substitution transitions with each instantiating exactly one own subnet. Although multiple substitution transitions may instantiate the same subnet layout each transition has it’s own permanent instance. Also subnets may contain substitution transitions containing further subnets resulting in a deeper hierarchy. Figure 2.1 shows a hierarchical net with it’s main net SuperPage and a subnet SubPage. In the main net the substitution transition SubTrans has five socket places: PA, PB and PC have edges connecting them to SubTrans, SubTrans has two edges connecting it to the places PD and PE. These places can also be found in the subnet as port places connecting to and from different transitions. If tokens are added to the places PA, PB or PC via the transitions T1 or T2 these will also appear in the subnet. There the transitions T4 and T5 can fire and remove tokens from PA, PB and PC resulting in the removal of the same tokens from the super net. This applies to all port and socket places.
Figure 2.1: Transition substitution [Jensen und Rosenberg (1991)]
4
2 Background on Petri Net Technologies
Place Substitution Technique Place substitution works similar to transition substitution. First a place to substitute has to be chosen. Than a subnet is created for said place. Similar to the port places of the transition substitution port transitions are created. Each port transition corresponds to one ore more socket transitions. Whenever a socket transition fires the corresponding port transition in the subnet fires simultaneously. When a port transition fires one of the corresponding socket transitions fires simultaneously. During each simulation step one transition can fire, the firing transition can be from either the main net, any subnet or a pair of port-socket transitions. Any net can contain multiple substitution places with each instantiating exactly one own subnet. Although multiple substitution places may instantiate the same subnet layout each transition has it’s own permanent instance. Also subnets may contain substitution places containing further subnets resulting in a deeper hierarchy. Figure 2.2 shows a hierarchical net with it’s main net SuperPage and a subnet Queue. Four transitions called Put and Init connect to the substitution place SubPlace. SubPlace is connected to two transitions called Get. All socket transitions sharing the same name are combined into one port transition in the subnet resulting in only three port transitions. When any of the transitions labeled Put or Init fire, tokens are added to the places P4 and/or P5 thus adding tokens to the subnet. If the subnets Get transition fires one of the main nets Get transitions will fire and add a token to the place P3. This way tokens enter and leave the subnet.
Figure 2.2: Place substitution [Jensen und Rosenberg (1991)]
5
2 Background on Petri Net Technologies
2.2 Reconfigureable Petri nets Reconfigurable Petri nets extend normal Petri nets to include the ability for dynamic change. This is achieved through the use of a rewriting system in the form of rules for the transformation of the net. This allows the modification of the net’s structure at run time, which can be used in the modeling of dynamic reconfigurable hardware like FPGAs or flexible manufacturing systems. When modeling such a system two kinds of changes need to be included, for one a change of state which is accomplished through the firing of Petri net transitions but also the process itself can experience changes for which the rule based rewriting system is used. A reconfigurable Petri net consists of a Petri net and a set of rules, in the algebraic approach a marked Petri net N is described as a tuple, N = (P, T, pre, post, M0 )
(2.1)
where P is a set of places and T a set of transitions. The pre- and post-domain functions pre, post : T → P ⊕ describe pre- and post-conditions for all transitions. The pre-conditions describe how many tokens are required for the firing of a transition while the post-conditions describe the placement of tokens during the firing of a transition. M0 ∈ P ⊕ is a set of tokens and defines the initial marking of the net. P ⊕ is the free commutative monoid over P . (Juhás u. a. (2007) / Meseguer und Montanari (1988)) The addition of a set of Rules R to such a Petri net N forms a reconfigurable Petri net RN = (N, R). This addition allows reconfigurable Petri nets to modify themselves. Rules are defined by three nets L, K and R and their strict net morphisms as r ∈ R = (L ← K → R)
(2.2)
where L is the left-hand side and K is an interface between L and R. R is the right-hand side which is inserted into the original net N . An occurrence morphism o : L → N is required to identify the relevant parts of the left-hand side L in N . The basic idea is that L is found in the net N and gets replaced by R. A reconfigurable Petri net N can either fire an activated transition or execute a transfor(r,o)
mation step N ==⇒ M . Figure 2.3 illustrates the transformation of a net using two pushout complements (1) and (2). This is possible because PT nets can be proven to be an M-adhesive transformation category. Padberg (2015)/ K Ehrig und G Taentzer (2006) An example for this process is displayed in figure 2.4. It shows in (a) a reconfigurable Petri net N and in (b) it’s rule r with r’s nets L, K and R. N consists of two places, two tokens and
6
2 Background on Petri Net Technologies
Figure 2.3: Transformation of a net Padberg (2015)
(a) RPNBSPN
(b) RPNBSPR
Figure 2.4: Example Petri net N and rule r one transition which is marked black when activated. When rule r is executed the net’s arcs are inverted. In it’s initial state (1) the rule r is not executable because there is no match to the rules L net. L specifies that at least two tokens are needed on the place P where the edges lead to, which is at the bottom. So only the transition T can fire. After transition T firing twice state (3) is reached. In this state two tokens are located on the bottom place P and r can be executed inverting the arc directions resulting in state (4). If in state (3) there would have been an additional token on the upper place P either the transition T could have fired or r could have been executed. In state (4) r is no longer executable because the edges now lead to the upper place P , so only the transition T can fire. State (4) is very similar to state (1) and after T firing twice r would be executable once again.
7
2 Background on Petri Net Technologies
2.3 ReConNet To model and simulate the capabilities of reconfigurable Petri nets a tool called ReConNet [Padberg u. a. (2012)] can be used. It is completely implemented in Java 6. ReConNet provides a graphical user interface as can be seen in figure 2.5. In the left center Petri nets and rules can be managed. Petri nets will be displayed in the center, rules with their nets L, K and R at the bottom. The top part of ReConNet’s GUI shows from the left to the right: modeling tool selection, node attributes and simulation/transformation tools.
Figure 2.5: ReConNet’s graphical user interface Instead of a span approach for rules: r ∈ R = L ← K → R, ReConNet uses a co-span approach as described in Ehrig u. a. (2009) for it’s rules: r ∈ R = L → K ← R. This results in the gluing net K being a union of L and R that contains all places, transitions and edges that are in at least one of them. The span and co-span approaches result both in the same net after the transformation.
8
2 Background on Petri Net Technologies
The basis for ReConNet are decorated PT nets [Padberg (2012)]. Decorated PT nets extend PT nets with additional decorations like names for places and transitions, capacities and transition labels that can change during the firing of a transition. The additional labels allow further coordination of transition firing and rule application. This provides a tool to control the application of rules whilst preserving the nets behavior. After each change to a Petri net through a transformation ReConNet uses a dynamic graph drawing algorithm. The algorithm rearranges the nets nodes to create a new layout so that newly created or removed nodes fit without layout issues like overlapping. The used algorithm is addressed further in chapter 3.2.
2.4 Related Work In the field of reconfigurable hierarchical graphs especially Petri nets not much work has been done. Diaz-Calderon u. a. (2000) aims for a component based reconfigurable modeling paradigm for simulation. It uses mechatronic systems as an example to illustrate a port based modeling paradigm as shown in figure 2.6. The presented design is constrained to the replacement of complete component modules only. The replacement module also has to have the same port configuration to fit its module slot. There are a number of tools similar to ReConNet. Snoopy [Heiner u. a. (2012)] is a unifying Petri net framework with a graphical user interface. It Figure 2.6: Reconfigurable model of Diazallows the modeling and simulation of colored and Calderon u. a. (2000) uncolored Petri nets of different classes, supports analytic tools and the hierarchical structuring of models. CPN tools [Ratzer u. a. (2003)] is another tool for the modeling and simulation of colored Petri nets. Using a graphic user interface CPN tools features syntax checking, code generation and state space analysis. The HiPS tool [HiPS2017 (2017)] developed at the Department of Computer Science and Engineering, Shinshu University is a tool written in C# and also employs a graphical user
9
2 Background on Petri Net Technologies
(a) SNOOPY
(b) CPNT
(c) HIPS
Figure 2.7: Petri net tools
interface. HiPS is a platform for design and simulation of hierarchical Petri nets. It also provides functions of static and dynamic net analysis. While all of these tools support the design of hierarchical Petri nets each lacks ReConNet’s core feature the aspect of reconfigurability. A use case for hierarchical Petri nets can be found in Sun u. a. (2014). There hierarchical colored Petri nets are used to model the French railway interlocking system RIS for formal verification and logic evaluation. The RIS system is responsible for the safe routing of trains. Detailed verifications and evaluations are mandatory before deploying an RIS, since it is a safety critical system. The paper describes how the signaling control and the railway road layout are specified and constructed into a colored hierarchical Petri net. Zhang und Zhu (2009) uses hierarchical colored Petri nets to model the production process of a cold rolled steel mill. For this a crude description of the entire running process of the system is given at the main net, and the more detailed behaviors are specified in the subnets. It is shown that the design is highly consistent with real production, improving the development efficiency for production planning and scheduling.
10
3 Dynamic Graph Drawing Drawings are an attractive and effective way of conveying information. Graph drawing includes all aspects of visualizing structural relations. A graph consists of objects or entities, usually referred to as vertices, and relationships between them, called edges. The automated generation of graph drawings has important applications in many areas of computer science. One of them is the visualization of dynamic graphs. A static graph and a dynamic graph differ as the structure of the vertices and edges as well as their attributes can change over time in a dynamic graph. The transformation of reconfigurable Petri nets puts their visualization in the category of dynamic graphs. Therefor in section 3.1 several drawing techniques are considered for implementation. Section 3.2 highlights ReConNet’s preexisting drawing algorithm and the specific implementation of the selected drawing technique from section 3.1.
3.1 Dynamic Graph Drawing Techniques Since the field of dynamic graph drawing is vast, a complete overview is not the main focus of this section. So only techniques that are applicable to reconfigurable Petri nets are pursued further. A complete overview can be found in Beck u. a. (2014) which provides a comprehensive basic review of state-of-the-art techniques in dynamic graph visualization. The main challenge of dynamic drawing techniques is often described as the preservation of the mental map. The mental map is the graphs visualization the user keeps in his mind. Severe changes of the graph in one step can change the graph beyond recognition and thus destroy the users mental map. This impedes following the changes and understanding the graph itself. To select a proper visualization technique for reconfigurable Petri nets in ReConNet the field has been narrowed down. Figure 3.4 supplies a structured overview of dynamic graph drawing techniques. Drawing techniques can be divided into the animation and timeline category. Timeline techniques plot graphs onto timelines while animation techniques display one graph at a time or a sequence of graphs. Displaying Petri nets falls into the category of animation.
11
3 Dynamic Graph Drawing
Figure 3.1: Overview of dynamic graph visualization techniques. Beck u. a. (2014)
Animated graphs may have a special purpose or a general layout. An example for a special graph is the compound graph. It adds a layer of hierarchy which helps to abstract from single vertices to groups of vertices. This is particularly useful for larger graphs with thousands of vertices. Other special techniques are tailored around a specific purpose depending on the application. Because Petri nets tend to have fewer vertices a general layout is usually the choice for their animation. A general layout does not impose any requirements on the graph type. During the drawing process of a new graph previous graphs can be factored in to keep the visual changes to a minimum. A technique employing this method is called online. Offline methods also use future graphs to not only to keep the changes from the previous graph to the current one to a minimum, but also to change the current graph in a way that reduces the changes to the next. For this method future graphs must be known ahead of time. An other method tries to smooth out larger differences from one version of a graph to the next by dividing multiple changes that happened during that step into intermediate steps. For these steps graphs can be created and presented to the user to make the transition of the graph more understandable. This transition technique is independent from the online or offline method. ReConNet allows immediate changes by the user, also the newest version should be displayed as soon as possible. Due to this circumstance future layouts of the displayed graph are impossible to predetermine and cannot be factored in when a new graph version is drawn. Typically the number of simultaneous changes to a reconfigurable Petri net is modest. It follows that for ReConNet an online animation layout is necessary. The three mayor techniques in this field are hierarchical layouts, orthogonal layouts and force-directed models.
12
3 Dynamic Graph Drawing
Figure 3.2: The same node-link graph drawn using three different layouts. Beck u. a. (2014)
Hierarchical Layout Hierarchical drawn graphs organize vertices in horizontal layers with edges generally directed downwards. Although cycles are possible they hurt the layout and are to be avoided. North und Woodhull (2001) puts forward a hierarchical graph drawing approach for online animation. Following its name this kind of layout pushes a hierarchical look onto any graph it is used on which works well for trees, relationship or reachability graphs.
Orthogonal Layout In orthogonal Layouts edges are only drawn along horizontal or vertical axes. During a conversion to an orthogonal layout angles will be derived to their closest 90° equivalent, as can be seen in the example from figure 3.3. To complete this task and to maintain the mental map Bridgeman und Tamassia (1998) suggest metrics based on distance, proximity and orthogonal ordering of vertices, to maintain relative position and ordering of vertices, and shape and topology of edges to preserve the order and look of edges around a vertex. The mayor drawback of the layout is the restriction to orthogonality.
Figure 3.3: A floor plan redrawn using an orthogonal layout. Brandes u. a. (2002)
13
3 Dynamic Graph Drawing
Force-directed Model In Fruchterman und Reingold (1991) a force-directed graph model was introduced. The presented model achieves vertex placement by applying a physical model to the vertices of the graph. All vertices apply repulsive forces to each other and all edges are modeled as springs with a preferred length. This results in the edges aspiring similar lengths and the vertices being at least at a minimum distance from each other.
Figure 3.4: Application of the force-directed model to a Petri net.
14
3 Dynamic Graph Drawing
3.2 Implemented Layout For the implementation the force-directed model is chosen for several reasons. Petri nets contain cycles on a regular basis or lack hierarchic structures. So the hierarchical layout is unsuited for the universal use in ReConNet. The force-directed model provides a flexible layout that does not impose any restrictions on vertex or edge placement which made it the more appealing choice over orthogonal layouts. Additionally ReConNet already uses the basic force-directed model presented by Fruchterman und Reingold (1991) which was advanced further in Frishman und Tal (2008). The preexisting force-directed model is used as a basis while being extended with an aging concept from Jucknath-John u. a. (2007) and Gorochowski u. a. (2012).
Preexisting force-directed model As already stated in a previous section the preexisting method for graph drawing uses a forcedirected model. In this model every vertex is subject to attractive forces fa and repulsive force fr . They are described by fa (d) = d2 /k
(3.1)
fr (d) = k 2 /d
(3.2)
where d is the current distance between two vertices and k the optimal distance. While repulsive forces are calculated between all vertices the attractive forces are only applied to vertices connected by an edge. The optimal distance k can be calculated. The goal of the calculation is to distribute all vertices evenly in the available area. k can be computed as follows k=C
p (
area ) numberof vertices
(3.3)
where the constant C is found experimentally. The model repeats two steps for a set number of iterations. Higher number of iterations result in more stable graph constellations, until no further meaningful changes occur. The default value was set to 700 iterations. During the first step of each iteration, forces for all vertices are calculated and each vertex is moved according to their forces. A global value temperature t limits this movement by capping the maximum movement range. In the preexisting model the temperatures base value t0 is set
15
3 Dynamic Graph Drawing to 1/10 of the areas width. The current iterations temperature is ti and no vertex can move further than ti in one move. The second step is to decrease the temperature. The temperature is decreased as follows ti+1 = ti ∗ (1 −
i ) n
(3.4)
with i being the current iteration and n the number of total iterations. So the temperature reaches 0 after the last iteration. This leads to the adjustments becoming finer as the layout becomes better. After this cooling step the next iteration will begin.
16
3 Dynamic Graph Drawing
The following code from Fruchterman und Reingold (1991) shows the whole process. 1 2 3 4 5
area := W * L; { W and L are the width and length of the frame } G := (V, E); { the vertices are assigned random initial positions } k := sqrt( area / |V|); function f_a(z) := return x^2/k; function f_r(z) := return k^2/z;
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
for i := 1 to iterations do begin { -- calculate repulsive forces --} for v in V do begin { each vertex has two vectors: .pos and .disp } v.disp := 0; for u in V do if (u # v) then begin { D is short hand for the difference} { vector between the positions of the two vertices ) D := v.pos - u.pos; v.disp := v.disp + ( D /| D |) * fr (| D |) end end { -- calculate attractive forces -- } for e in E do begin { each edge is an ordered pair of vertices .v and .u } D := e.v.pos - e.u.pos; e.v.disp := e.v.disp - ( D/| D |) * fa (| D |); e.u. disp := e.u.disp + ( D /| D |) * fa (| D |) end
27 28 29 30 31 32 33 34 35 36 37 38
{ limit the maximum displacement to the temperature t } { and then prevent from being displaced outside frame} for v in V do begin v.pos := v.pos + ( v. disp/ |v.disp|) * min ( v.disp, t ); v.pos.x := min(W/2, max(-W/2, v.pos.x)); v.pos.y := min(L/2, max(-L/2, v.pos.y)) end { reduce the temperature } { as the layout approaches a better configuration} t := cool(t) end
17
3 Dynamic Graph Drawing
Aging extension When a vertex is added or removed from a stable graph it upsets the previous equilibrium of forces. This leads to a new graph layout, although this is a the desired behavior keeping previous structures intact is greatly beneficial to preserving the users mental map. Keeping vertices at similar positions in both the old and the new layout helps fulfill this requirement. This can be achieved by a concept of aging propagated in Jucknath-John u. a. (2007) and Gorochowski u. a. (2012). For this concept every vertex is assigned an age. New vertices start with an age = 1. If a vertex is part of the old and the new graph it grows older. The higher the age the less the corresponding vertex should move, to achieve this a vertexes age acts as a modifier for the vertices temperature. For the implementation in ReConNet a vertexes age is equivalent to the number of graphs it has been in. Also a maximum age is defined: once a vertex has reached the age maximum it remains at that level and ages no further. The age’s impact on a vertexes temperature t is realized as a coefficient t(vertex) = t(graph) ∗ Ca
(3.5)
The age coefficient Ca can be derived from the age as follows Ca = 1 + (age − 1) ∗
Cmin − 1 agemax − 1
(3.6)
with Cmin being a preset minimum for Ca and agemax being the maximum age. This results
Figure 3.5: Age coefficient with Cmin = 0.2 and agemax = 10
18
3 Dynamic Graph Drawing in a linear degression of Ca from 1 until its minimum Cmin is reached at maximum age. Figure 3.5 illustrates Ca ’s behavior with Cmin = 0.2 and agemax = 10. Although nonlinear approaches are possible as well this linear approach proved to produce better results during implementation and experimentation. Figure 3.6 shows the impact after two insertions of two vertices into a graph.
Figure 3.6: Petri net in ReConNet befor and after two redraws caused by the addtion of B1 and B2 in the first redraw and C1 and C2 in the second.
19
4 Concept In this chapter the conceptual choices for the integration of hierarchical Petri nets into ReConNet are presented. Two major choices are the hierarchical model which is to be used and the way reconfiguration rules are applied to the hierarchical Petri nets. These decisions are elaborated in the following sections 4.1 and 4.2. Section 4.3 will highlight ReConNet’s basic structure and what program components have to be altered to support the new model.
4.1 Hierarchical Model Chapter 2.1 described what a hierarchical Petri net is and the kinds of hierarchical Petri nets. For ReConNet the use of substitution transitions is chosen as they are described in chapter 2.1, Jensen und Kristensen (2009) chapter 5 and Jensen und Rosenberg (1991) chapter 7. Substitution transitions are chosen because many tools like snoopy, CPN tools or HiPS use substitution transitions which allows if not compatibility, at least comparability. Also a majority of papers concerned with hierarchical Petri nets use substitution transitions to achieve their goal, Sun u. a. (2014) uses hierarchical colored Petri nets to model the French railway interlocking system and Zhang und Zhu (2009) used hierarchical colored Petri nets to improve the planning and scheduling efficiency of a cold rolled steel mill. The addition of hierarchical Petri nets to ReConNet aims to support the usage of hierarchical Petri nets for as many applications as possible. The usage of port places in substitution transitions also allows employing a relatively easy flattening process, which can be useful for future net validation. During the flattening process the substitution transition is replaced with the subnet and all edges to the subnet’s port places are connected to the corresponding places in the super net. In figure 4.1 this process is used on a simple hierarchical net.
20
4 Concept
Figure 4.1: Flattening of a substitution transition with port places.
21
4 Concept
It is necessary to mention that the flattening process of a reconfigurable hierarchical Petri net is more complex than of a normal hierarchical Petri net. This is due to the fact that in the process of flattening a normal hierarchical Petri net all information on where the hierarchical borders were located are lost. The upcoming chapter 4.2 explains how and why rules in a reconfigurable hierarchical Petri net are limited by hierarchical borders. So additional steps during the flattening process of a reconfigurable hierarchical Petri net are necessary to assure that a transformed net is always the same in both the cases of first applying a rule and than flattening and first flattening and than applying a rule. Additional labeling of both the rules and parts of the decorated net during the flattening process can serve this purpose.
Figure 4.2: Flattening and transformation of a reconfigurable hierarchical net.
22
4 Concept
4.2 Rule Application As chapter 2.2 elaborated, reconfigurable Petri nets use rules to reconfigurate themselves. The combination with a hierarchical model presents a certain challenge. With the chosen hierarchical model from the previous section 4.1 rules can be applied as global rules, net individual rules or layer based rules.
Global Rules Global rules will be applied to the main net, its sub-nets, all their sub-nets and so forth. This requires to make general rules that the whole hierarchical net may apply.
Figure 4.3: Application of global rules to a hierarchical Petri net.
Net Individual Rules A net individual rule set allows rules to only be applied to a specific net. The same rule can also be applied to multiple different nets at the same time. Individual rules enable the dynamic modification of a specific module or subset of a hierarchical net. The advantage of this is, rules can be created without the possibility of issues in other parts of the hierarchical net, and thus the rule’s designer does not have to know the complete hierarchical net.
23
4 Concept
Figure 4.4: Application of net individual rules to a hierarchical Petri net.
Layer Based Rules Layer based rules are applied to nets relative to the main net. While in layer 1 there is only the main net, layer 2 composes of all subnets that are derived directly from the main net. Layer 3 composes of all their direct child nets and so on.
Rule Implementation Concerns For the future implementation, at first global rules will be realized, followed by net individual rules. Layer based rules will remain optional, because at this point their usefulness remains uncertain. Individual rules can be used to obtain the same rule configuration. This requires more effort because each rule has to be assigned to each net of a given layer individually and to each new net being added to that layer. For the application of rules, especially of global rules, the hierarchy borders must be preserved. Changes along those borders are different from those in a flat net. Figure 4.6 shows a net with one subnet. To the net a global rule is applied as shown in figure 4.7. This rule adds two places and can be applied at multiple locations.
24
4 Concept
Figure 4.5: Application of layer based rules to a hierarchical Petri net.
Figure 4.6: A basic reconfigurable hierarchical Petri net.
In figure 4.8 three matches of the rule are possible. The addition of the places marked in green and yellow is straight forward. The addition of the places marked in red would be possible in the flattened net. The hierarchical layout excludes the rule application across hierarchy borders. Thus the rule must not be applied under such constraints.
25
4 Concept
Figure 4.7: Rule for the reconfigurable Petri net.
Figure 4.8: Considered rule application locations.
26
4 Concept
4.3 Implementation Approach To allow the functionality of reconfigurable hierarchical Petri nets in ReConNet parts of ReConNet have to be extended. In particular visualization, Petri net structure and Petri net transformation. ReConNet consists of five main components: gui, petrinet, persistence, transformation and engine. Two packages: exceptions and util support the components with custom exceptions and other utensils. For the implementation of the hierarchical model presented in section 4.1 the preexisting Petri net structure will have to be extended. Changes to support the new hierarchical model are made in the petrinet component. It contains ReConNet’s Petri net functionalities like creating Petri nets, editing Petri nets, activating transitions and firing transitions as wells as the Petri net model itself. These changes include the addition of subnets housing substitution transitions and special port places for tokens to enter and exit these subnets. As a result the persistence component which bundles all functionalities around saving and loading Petri nets into local files also needs to be updated with the new Petri net model. For a net transformation a rule is applied on a Petri net under a match, the transformation component is responsible for creating, editing and applying rules as wells as finding matches. For this it directly accesses the petrinet component. To implement the global and individual rules presented in section 4.2 matching has to be updated and access to the petrinet component refined. At the moment ReConNet can display one Petri net and one rule at a time, while that is still sufficient this detail can impede following the interactions in subnets. Other hierarchical Petri net tools such as Snoopy and CPN tools use multiple windows, giving the ability to watch all relevant subnets at once. HiPS on the other hand uses tabs with a dynamically shifting focus. If following the interactions proves to be an issue changes to the gui component can be done. The gui component manages the graphical user interface. It is divided into six areas (panes). Multiple Petri net windows can be employed through changes to the gui’s PetrinetPane. The engine component joins all the other components together and controls the program flow. Fundamental changes to ReConNet’s general structure are not planned hence changes to this component will remain fairly limited.
27
5 Conclusion In this chapter a summarizing conclusion followed by a short outlook on following works is given. This work presents the groundwork for the future integration of reconfigurable hierarchical Petri nets into the ReConNet tool [Padberg u. a. (2012)]. Reconfigurable hierarchical Petri nets combine the advantages of hierarchical Petri nets and reconfigurable Petri nets in one. This combination brings clarity through abstraction and allows the modeler to concentrate on only a few details at a time while also providing the ability for dynamic change. With the planned integration of reconfigurable hierarchical Petri nets into ReConNet an adequate tool for the modeling process will be available. As a first step in chapter 2 this work provides a review of the basics of hierarchical and reconfigurable Petri nets as well as an introduction into ReConNet followed by related works. To guarantee a comprehensible presentation of the dynamic Petri net graphs, different graph drawing techniques are discussed in chapter 3. After weighing their applicability for reconfigurable Petri nets, a layout model comparable to ReConNet’s preexisting force-directed model is chosen. The force-directed design is then presented and improved using an algorithm that uses node ages to obtain a more solid graph. The design supports the preservation of the user’s mental map while working with reconfigurable Petri nets. Chapter 4 offers conceptual choices. An approach using substitution transitions with port and socket places was picked for the hierarchical model. Which is a widely used concept in both hierarchical Petri net applications and hierarchical Petri net modeling tools. And thus supporting as many applications as possible. Regarding the hierarchy dependent rules a system consisting of global and (sub-)net individual rules was proposed. For future works section 4.3 considers ReConNet’s structure and the approach to further development. Following this work will be a second project and a master thesis. In the upcoming works the concept shown in chapter 4 will be used to implement the simulation of hierarchical Petri nets in ReConNet. This includes the realization of section 4.1’s hierarchical Petri net structure, it’s simulation and the application of sections 4.2’s global and individual rules. Challenges that are hard to evaluate are the degree of changes necessary
28
5 Conclusion
to ensure continued persistence functionality and the changes to ReConNet’s graphical user interface to improve the visualization of hierarchical Petri nets. Finally further works seek to accomplish complete support of hierarchical Petri nets in ReConNet, including verification. For this a mayor challenge is the development of a flattening and labeling algorithm that preserves the correctness of the hierarchical constrained rules within the flattened net. This is necessary because net analysis is easiest performed on a flat net.
29
Bibliography [HiPS2017 2017]
:
HiPS : Hierarchical Petri net Simulator.
2017. –
URL https:
//sourceforge.net/projects/hips-tools/ [Beck u. a. 2014]
Beck, Fabian ; Burch, Michael ; Diehl, Stephan ; Weiskopf, Daniel: The
state of the art in visualizing dynamic graphs. In: EuroVis STAR 2 (2014) [Brandes u. a. 2002]
Brandes, Ulrik ; Eiglsperger, Markus ; Kaufmann, Michael ; Wagner,
Dorothea: Sketch-driven orthogonal graph drawing. In: International Symposium on Graph Drawing Springer (Veranst.), 2002, S. 1–11 [Bridgeman und Tamassia 1998]
Bridgeman, Stina ; Tamassia, Roberto: Difference metrics
for interactive orthogonal graph drawing algorithms. In: International Symposium on Graph Drawing Springer (Veranst.), 1998, S. 57–71 [Diaz-Calderon u. a. 2000]
Diaz-Calderon, Antonio ; Paredis, Christiaan J. ; Khosla,
Pradeep K.: Reconfigurable models: A modeling paradigm to support simulation-based design. In: Summer Computer Simulation Conference Citeseer (Veranst.), 2000, S. 388–394 [Ehrig u. a. 2009]
Ehrig, Hartmut ; Hermann, Frank ; Prange, Ulrike: Cospan DPO approach:
An alternative for DPO graph transformations. In: Bulletin of the EATCS (2009), S. 139–146 [Frishman und Tal 2008]
Frishman, Yaniv ; Tal, Ayellet: Online dynamic graph drawing.
In: IEEE Transactions on Visualization and Computer Graphics 14 (2008), Nr. 4, S. 727–740 [Fruchterman und Reingold 1991]
Fruchterman, Thomas M. ; Reingold, Edward M.: Graph
drawing by force-directed placement. In: Software: Practice and experience 21 (1991), Nr. 11, S. 1129–1164 [Gorochowski u. a. 2012]
Gorochowski, Thomas E. ; Bernardo, Mario di ; Grierson,
Claire S.: Using aging to visually uncover evolutionary processes on networks. In: IEEE transactions on visualization and computer graphics 18 (2012), Nr. 8, S. 1343–1352
30
Bibliography
[Heiner u. a. 2012]
Heiner, Monika ; Herajy, Mostafa ; Liu, Fei ; Rohr, Christian ; Schwar-
ick, Martin: Snoopy–a unifying Petri net tool. In: International Conference on Application and Theory of Petri Nets and Concurrency Springer (Veranst.), 2012, S. 398–407 [Jensen und Rosenberg 1991]
Jensen, K ; Rosenberg, G: High-Level Petri nets: Theori and
Application. 1991. In: Berlin, Gernany: Springer-Verlag (1991) Jensen, Kurt ; Kristensen, Lars M.: Coloured Petri nets:
[Jensen und Kristensen 2009]
modelling and validation of concurrent systems. Springer Science & Business Media, 2009 [Jucknath-John u. a. 2007]
Jucknath-John, Susanne ; Graf, Dennis ; Taentzer, Gabriele:
Evolutionary layout of graph transformation sequences. In: Electronic Communications of the EASST 1 (2007) [Juhás u. a. 2007]
Juhás, Gabriel ; Lehocki, Fedor ; Lorenz, Robert: Semantics of petri nets:
A comparison. In: Simulation Conference, 2007 Winter IEEE (Veranst.), 2007, S. 617–628 [K Ehrig und G Taentzer 2006]
K Ehrig, H E. ; G Taentzer, U P.: Fundamentals of al-
gebraic graph transformation. With 41 Figures (Monographs in Theoretical Computer Science. An EATCS Series). 2006 [Koci u. a. 2008]
Koci, Radek ; Janousek, Vladimir ; Zboril Jr, Frantisek: Object Oriented
Petri Nets Modelling Techniques Case Study. In: Computer Modeling and Simulation, 2008. EMS’08. Second UKSIM European Symposium on IEEE (Veranst.), 2008, S. 165–170 [Meseguer und Montanari 1988]
Meseguer, José ; Montanari, Ugo: Petri nets are monoids:
A new algebraic foundation for net theory. In: Logic in Computer Science, 1988. LICS’88., Proceedings of the Third Annual Symposium on IEEE (Veranst.), 1988, S. 155–164 [Miyamoto und Kumagai 2005]
Miyamoto, Toshiyuki ; Kumagai, Sadatoshi: A survey of
object-oriented Petri nets and analysis methods. In: IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences 88 (2005), Nr. 11, S. 2964–2971 [North und Woodhull 2001]
North, Stephen C. ; Woodhull, Gordon: Online hierarchical
graph drawing. In: International Symposium on Graph Drawing Springer (Veranst.), 2001, S. 232–246 [Padberg 2012]
Padberg, Julia: Abstract interleaving semantics for reconfigurable Petri nets.
In: Electronic Communications of the EASST 51 (2012)
31
Bibliography
[Padberg 2015]
Padberg, Julia: Reconfigurable Petri Nets with Transition Priorities and
Inhibitor Arcs. In: International Conference on Graph Transformation Springer (Veranst.), 2015, S. 104–120 [Padberg u. a. 2012]
Padberg, Julia ; Ede, Marvin ; Oelker, Gerhard ; Hoffmann, Kathrin:
Reconnet: a tool for modeling and simulating with reconfigurable place/transition nets. In: Electronic Communications of the EASST 54 (2012) [Ratzer u. a. 2003]
Ratzer, Anne V. ; Wells, Lisa ; Lassen, Henry M. ; Laursen, Mads ;
Qvortrup, Jacob F. ; Stissing, Martin S. ; Westergaard, Michael ; Christensen, Søren ; Jensen, Kurt: CPN tools for editing, simulating, and analysing coloured Petri nets. In: International Conference on Application and Theory of Petri Nets Springer (Veranst.), 2003, S. 450–462 [Sun u. a. 2014]
Sun, Pengfei ; Collart-Dutilleul, Simon ; Bon, Philippe: A formal
modeling methodology of the French railway interlocking system via HCPN. In: WIT Transactions on The Built Environment 135 (2014), S. 849–858 [Zhang und Zhu 2009]
Zhang, Yong ; Zhu, Jing: Product line system modeling of the
cold-rolled mill based on the hierarchy colored petri nets. In: Automation and Logistics, 2009. ICAL’09. IEEE International Conference on IEEE (Veranst.), 2009, S. 1553–1557
32
Hiermit versichere ich, dass ich die vorliegende Arbeit ohne fremde Hilfe selbständig verfasst und nur die angegebenen Hilfsmittel benutzt habe.
Hamburg, 10. May 2017 Jan-Uriel Lorbeer