Formal and Executable Specification of Random Waypoint Mobility Model Using Timed Coloured Petri Nets for WMN

and Applied Analysis 3 of nodes called places (circles)and transitions (rectangles) and arcs that connect them. It is important to note that two places or two transitions cannot be connected consecutively. A Petri net is a four-tuple, with an initial markingM 0 : PN = (P, T, I, O), where P: a finite set of places, {p 1 , p 2 , . . . , p n }, T: a finite set of transitions, {t 1 , t 2 , . . . , t s }, I: an input function, (T × P) → {0, 1}, O: an output function, (T × P) → {0, 1}. A place p is an input place of a transition t if there exists an input arc from place to transition. Place p can be called as an output place of transition t if there exists an output arc from transition to place. Definition 2 (colouredPetri nets). The coloured petri net is an extension of Petri net, which contains tokens, differentiated by “colour.” A coloured petri net is a nine-tuple satisfying the below requirements: CPN = (P, Σ, T, A, V, C, G, E, I), where (1) P is a finite set of places. (2) Σ is a finite set of nonempty types, also called color sets. It determines the data values, operations, and functions that can be used in the net expressions. (3) T is a finite set of transitions T such that P ∩ T = φ. (4) A ⊆ P × T ∪ T × P is a set of directed arcs. (5) V is a finite set of typed variables such that type [V] ∈ Σ for all variables V ∈ V. (6) C : P → Σ is a colour set function that assigns a colour set to each place. This means that each token on pmust have a data value. (7) G : T → EXPR V is a guard function that maps each transition t in to a Boolean expression such that type[G(t)] = Bool. (8) E : A → EXPR V is an arc expression function that maps each arc, a, into an expression of type [E(a)] = C(p) multiset, where p is the place connected to the arc a. (9) I : P →EXPR/0 is an initialization function that maps each place p into a closed expression which must be of Type[I(p)] = C(p)multiset. Definition 3 (hierarchical coloured Petri nets). The following definition formally summarizes the syntax and semantics of hierarchical CPN. A hierarchical coloured Petri net is a four-tuple CPN H = (S, SM,PS, FS) [21], where (1) S is a finite set of modules. Each module is a coloured Petri net module s = ((P, T, A, Σ, V, C, G s , E s , I s ), T s sub, P s port , PT s ). It is required that (P ∪ T s1 ) ∩ (P s2 ∪ T s2 ) = ́ φ for all s1, s2 ∈ S such that


Introduction
The wireless mesh network [1] is a communication network, which is a relatively new technology that has the potential to organize and configure them dynamically.WMNs are comprised of wireless mesh routers (WMRs) and mesh clients.Mesh routers have multiple interfaces and, with bridge functionality, enable the integration of mesh networks with other different wireless network domains.Mesh clients also have mesh networking functionality and can act as routers.WMNs have the potential to overcome the limitations of various other wireless networks such as ad mobile hoc networks (MANETs), wireless local area networks (WLANs), and wireless-fidelity (Wi-Fi).WMN is key wireless technology which has QoS mechanism to support various prominent applications.Routing is critical factor for analyzing data transfer from sender to destination.The common requirements of a reliable routing protocol are load balancing, congestion control, scalability, and reliability.WMN shares common features with ad hoc network so their routing protocol can be applied to WMNs; however mobility management for WMNs is much different than ad hoc networks and there is much room for improvement of mobility in WMNs.
Mobility in WMNs means that nodes are free to move in any direction any time with any speed arbitrarily.Therefore, the node mobility is key research paradigm in WMNs.Simulation is traditional tool for evaluating performance of networks but literature reflects that in some cases simulators generate unrealistic results which are not according to the specifications of the model.Some performance related issues of RWP have been identified in the literature.Due to socalled border effect [2] the model concentrates in the middle of its network environment as a spatial distribution of nodes is arbitrary.Many research results concluded this limitation of RWP mobility model for its implementation in wireless networks [3,4].The speed decay issue is another undesired behavior of RWP as reported in [5]; it shows that the average speed measured at beginning of the simulation is different from the ending speed and mean average speed is gradually decreasing with the passage of time.
Formal methods [6] have a great potential and proven to be a powerful tool for investigation of correctness of WMN routing protocols.The key factor, using formal methods in protocol engineering, is that it reduces the "time to market" and results obtained are unambiguous.Formal methods have rigorous computer based tool support for the requirements, realistic behavior of movement.In this paper, two-dimensional 100 × 100 m 2 terrains are constructed for random waypoint (RWP) mobility model, a benchmark, and the most utilized model in performance analysis for wireless networks.We apply CPNs and supporting CPN tools [15], which are based on CPN ML language, to model the RWP scenario.The proposed implementation improves the RWP mobility model by removing the "border effect" and resolves the "speed decay" problem.Previously a little work, for mobility patterns by using CP-nets, has been done in the literature.The proposed model provides a foundation and it can play a vital role for evaluating the performance of routing protocols through CP-nets.
The rest of the paper is organized as follows.Section 2 describes the related work in this domain.Section 3 describes brief introduction to the traditional RWP mobility model.Section 4 presents implementation of random waypoint mobility model by using CPN tools.Section 5 describes state space analysis of model and verification results.Finally Section 6 contains conclusions and summarizes our achievement.

Related Work
The movement scenario of mobile hosts plays a pivot role for evaluating in performance analysis of wireless communication networks scenarios.The literature reflects that much work has not been done on mobility issues of the wireless networks by using CP-nets.In [16], the authors developed CP-nets models with respect to macromobility and micromobility scenarios.The mobile node movement between different networks is called macromobility while movement within ad hoc network is called micromobility.The CPN model abstractly describes the communication and mobility specifications and communication scenarios in the ad hoc networks.A prominent feature of the CPN model is that it reflects the simultaneous communication and the mobility functionalities in a single model.This mode is also suitable for communication and mobility test cases.The authors in [17] suggested topology approximation (TA) structure to overcome the dynamically changing topology problem.The results showed that TA mechanism can mimic the dynamic changes of network topology.Synthetic RWP mobility model by using CPN has been presented in [18] however with some shortcomings, as the proposed model is not able to mimic the trace patterns of mobile host (MH).Khan et al. [19] presented coloured Petri nets (CP-nets) based formal model for implementation, simulation, and analysis of well-known random walk mobility model for WMN, without border effect and speed decay problems.The model is more appropriate for generating different mobility patterns; these patterns can further be used for analyzing the performance of routing protocols and mobility management in wireless communication networks.Fabulous efforts were made in [2] by removing border effect issue from RWP mobility model and spatial distribution generated by their developed model is different from standard model.

Theory of Random Waypoint Mobility Model
The random waypoint model was originally presented in [20]  A place  is an input place of a transition  if there exists an input arc from place to transition.Place  can be called as an output place of transition  if there exists an output arc from transition to place.
Definition 2 (coloured Petri nets).The coloured petri net is an extension of Petri net, which contains tokens, differentiated by "colour." A coloured petri net is a nine-tuple satisfying the below requirements: CPN = (, Σ, , , , , , , ), where (1)  is a finite set of places.
(2) Σ is a finite set of nonempty types, also called color sets.It determines the data values, operations, and functions that can be used in the net expressions.A hierarchical coloured Petri net is a four-tuple CPN  = (, SM, PS, FS) [21], where (2) SM :  sub →  is a submodule function that assigns a submodule to each substitution transition.
It is required that the module hierarchy is acyclic.
For of a hierarchical coloured Petri net CPN  , following concepts are defined [21].(5) A binding element is a pair ( * , ) such that  * is a transition instance of a transition  ∈  −  sub and  ∈ ( * ).The set of all binding elements BE( * ) for a transition instance  * is defined by BE( * ) = {( * , ) |  ∈ ( * )}.The set of all binding elements in CPN  is denoted by BE.
(6) A step  ∈ BE MS is a nonempty, finite multiset of binding elements.
The CPN model of RWP mobility model is organized in a set of modules, because it is impractical to draw a large system in a flat or single net.Other reason is that often system components are used repeatedly, so it is inefficient to draw these components from scratch every time, as shown in Figure 1; same instance of RWP module is repeated as N1, N2, N3, and N4.The relationship between modules of our proposed model is depicted in Figure 1; the modules names are written inside the nodes.The TOP module has no incoming arcs, so it is called the prime module; next N1 module has four instances.

Environment Scenario.
The random waypoint CPN model consists of 5 pages.Four nodes are spread randomly in a 100 × 100 m 2 communication area.Node N1 is randomly placed at (67, 10), N2 at (42, 17), N3 at (88, 91), and N4 at (24, 41) as shown in Figure 2. Model is as abstract view; however nodes can be enhanced.Approximate transmission range of 802.11n based MH transmitter is 250 m which is shown by circle.Time clock is considered in minutes.
The hierarchical CPN model is depicted in Figure 3, in top level page each MH is reflected by 2 places "COMPLETE" and "MONITOR" and one substitution transition "NODE" which has its associated subpage.

The Color Set.
The CPN ML language provides a predefined set of basic types inherited from SML functional programming language for declaring operations, variables, functions, constants, expressions, bindings, and colour set (types).The proposed RWP model has a set of declarations and introduces a number of colour sets.The colour sets are used to declare new colour sets like products and records; some important colour sets are used to construct RWP model which is reflected in Table 1 to elaborate their functionality.

The Functions.
It is convenient to write a complex expression as a function, similar to concept of methods and  procedures from conventional programming languages.The keyword fun is used to declare a function in CPN ML.Table 2 shows definitions of some important functions used to capture the desired behavior from proposed model.
In CPN model, states of a system which are represented by places and operations or events are modeled by transitions as shown in Figure 4.In the initial marking there is one token in the places RANSTARTX, RAN STARTY, CNTR, ROUND, and WATCHING, three tokens in place SPEED1, and eight tokens in place NEW DIRECTION, respectively.The initialization step of proposed model is responsible for initial distribution of tokens in initial marking.However it is possible for a user to manually specify initial marking.It is further contended; in our specific case we placed different number of tokens on different places, as per requirement of our model.For example, eight tokens of integer type in place NEW DIRECTION specify 8 angles from 0-360 degrees, that is, 45 ∘ , 90 ∘ , 135 ∘ , 180 ∘ , 22 ∘ , 270 ∘ , 315 ∘ , and 360 ∘ .
On completion every epoch MH selects new direction for next destination.On the other hand place SPEED1 contains three tokens of integer colour with values 1, 2, and 3 and a user can add more speed tokens or enhance the value.These tokens represent speed of the epoch and model randomly chooses one speed token for every destination.The single token in place RANSTARTX and RANSTARTY is used to identify home coordinates of MH.In the same way the places, CNTR, ROUND, and WATCHING, hold single token for speed counter, counting number of rounds, and monitoring current status of MH, respectively.
The place MONITOR1 has 348 tokens, showing traveling pattern from HOME to DESTINATION of N1.The places MONITOR2, MONITOR3, and MONITOR4 have 240, 255 and 227 tokens, respectively, reflecting movement trace patterns of MHs N2, N3, and N4.
sequences.MH can move in communication range without any restriction.HOME to DESTINATION paths of four mobile nodes have been reflected in Figure 6; the transmission range and the traveling path of every node as well as its neighbors can be seen, where node can communicate.
Liveness property specifies that every transition can be enabled from each marking by firing an arbitrary number of transitions.The RWP represents unlimited navigation within the system.Figure 7 gives some results from standard queries.As an example we can find path from  1 to  26780 by NodesInPath (1, 26780) query.Upper and lower bound properties are very prominent for analyzing; the upper and the lower bound tell the maximum and minimum number of tokens which a specific place can contain.This analysis is part of simulation, so it can  Traverse path form initial marking  1 to  26780 is investigated in Figure 8, and the shortest path is constructed.It is shown in Figure 8 that there are minimum four markings which must occur for constructing occurrence sequence from  1 to  26780 .It is shown that 26780 (9999, 9998, 9997, 9996, 9995, . ..) numbers are dead markings. 26780 tells us that there is 1 incoming arc and 0 outgoing arcs.It can be interpreted as a final marking for RWP mobility model and it is not a dead lock state.The deadlock state can be explained that all instructions have been executed and no lock exists on the system.However, occurrence of a deadlock state can be interpreted that some instructions have not been fully executed; its mean system is partially correct.
Figure 9 shows speed verses number of steps of two mobile nodes.It reflects that speed is constant and not gradually decreasing during a trip.N1 completed first itinerary in 27 steps with speed 1 while speed from first to last step remained constant.Thereafter, from step number 28 MH started 2nd epoch with speed 2 and reached its destination on step number 36.N2 started first route from step number 1 and completed at step number 16 with speed 3.After that N2 started second trip with speed 2 and completed it at step number 24.Same statistics can be seen for remaining steps in Figure 9 for both the nodes.

Conclusion
At

( 3 )( 6 )
is a finite set of transitions  such that  ∩  = .(4)  ⊆  ×  ∪  ×  is a set of directed arcs.(5)  is a finite set of typed variables such that type [V] ∈ Σ for all variables V ∈ . :  → Σ is a colour set function that assigns a colour set to each place.This means that each token on  must have a data value.(7)  :  → EXPR  is a guard function that maps each transition  in to a Boolean expression such that type[()] = Bool.(8)  :  → EXPR  is an arc expression function that maps each arc, , into an expression of type [()] = () multiset, where  is the place connected to the arc .(9)  :  → EXPR/0 is an initialization function that maps each place  into a closed expression which must be of Type[()] = () multiset.Definition 3 (hierarchical coloured Petri nets).The following definition formally summarizes the syntax and semantics of hierarchical CPN.

Figure 1 :
Figure 1: Instance hierarchy for the random waypoint mobility model.

( 1 )( 2 )
A marking  is a function that maps each compound place [ * ] into a multiset of tokens ([ * ]) ∈ () MS , where (,  * ) is any place instance belonging to [ * ].The initial marking  0 is defined by  0 ([ * ]) = (⟨ ⟩ where (,  * ) is any place instance belonging to [ * ]. (3) The variables of a transition instance  * of a transition  are denoted by Var( * ) and defined by Var( * ) = Var().(4) A binding of a transition instance  * of a transition  ∈  −  sub is a function  that maps each variable V ∈ Var( * ) into a value (V) ∈ Type[V].The set of all bindings for a transition instance  * is denoted by ( * ).

Figure 4 :
Figure 4: The CPN model of RWP mobility model.

Figure 5 :Figure 6 :
Figure 5: Traveling pattern of MH based on RWP mobility model.

Figure 9 :
Figure 9: Speed of 2 mobile nodes without speed decay problem.

Table 2 :
(20,function.MOVE function is used to move next step in desired direction, and finally CSTATUS is used to flag the status of current scenario.After firing transition START, token moves to FINISH place and enables MOVING transition, which takes 12 input parameters and decides the next move of MH; if current and destination tuples are the same, its mean node has reached its destination.Otherwise it increases step and next coordinates in the nodes payload and send back to FINISH place to repeat the process until node reaches its destination.When one epoch is completed, token moves to the place NEXT, and pause time is added by uniform random distribution(20, 40)function.NEW ROUTE transition takes 12 inputs and generates new epoch for MH and sends mobility information token to the place FINISH after adding pause time.FINISH place repeats the process until simulation ends.Figure5illustrates the top page after 1200 steps with time stamp 560.Top page is showing 4 nodes, that is, N1, N2, N3, (6,20)MOVE.After firing FIRST MOVE transition, one token moves to place INITIATE with parameters 1, 0, (60, 47), (60, 47),(6,20), ) @ 0, in this tuple 1 is Node ID, 0 is Step number, (60, 47) is home coordinates, (60, 47) reflects current coordinates, (6, 2) shows destination, HOME means initial state, and @ 0 reflects time of model.By firing transition ND token moves to place NODE, here CNTR function is implemented for increasing steps.Transition RAN SPEED generates speed for node movement and, after its occurrence, the transition START enables, which takes 10 parameters as input and sends token to place FINISH after calculation next coordinates, adds next step and delay of time @ 1.In START transition three functions are used, first to calculate next step function STEPINC is implemented,

Table 3 :
Movement pattern of 4 NODES after 1200 steps simulation.

Table 4 :
Statistics for o-graph.
the time of writing not much research work about CPNs based traditional RWP mobility model has been reflected by the literature.Most of existing mobility research is based on NS-2 simulator and we envisage that formal modeling based work, presented in this paper, will open new paradigm.The work presented in this paper is based on our efforts in developing an accurate and executable RWP mobility model without border effect and speed decay problems.Further, extensive simulations were conducted for the evaluation of proposed model.The model is more appropriate for generating different mobility patterns, and these patterns can be further implemented in analyzing the performance of routing protocols in wireless communication networks.There are several directions for future work; a more compact mobility model with tokens representing MHs can be extended.It can be easily modified and extended to capture the complex scenarios.