0 > where: Q is the set of locations (depicted as graph nodes), Σ is the set of interactions which this process could perform, → ⊆ Q × Σ × Q is the set of edges between locations, and q 0 is the initial location. However, designers of a component may add to its automaton timing constraints over interactions that may happen between the component and its environment. Formally, this approach consists in expressing time constraints by means of boolean formulas over logical clocks. Such variables express time progress but their values could be initialized and tested. A Timed Automaton extends an untimed one with three mappings as follows: The first mapping I assigns to each location a sojourn condition called invariant which may be true. The second mapping G assigns to each edge a timing guard which should be true to let the edge be taken. Last, the mapping Z associates with each edge a set of clock initializations which may be empty. The UPPAAL modeling language consists of timed automata extended further with discrete constants and bounded variables that are used as in programming languages: const int macMinBE := 3, aMaxBE := 5; const int maxMacCSMABackoffs := 5; Automata interact with each other through binary synchronization channels (e.g., chan c). An edge labeled with c! synchronizes with another labeled c?. A synchronization pair is chosen non-deterministically if several combinations are enabled. In a broadcast synchronization, one sender uses a broadcast channel collision! to synchronize with an arbitrary number of receivers collision?. Any receiver that can synchronize in the current state must do so. Arrays are also allowed for clocks, channels, and integer variables, e.g. chan beginSend[NBR STATIONS]; A state of the system is defined by the locations of all automata, the clock constraints, and the values of the discrete variables. Every automaton may fire an edge separately or synchronize with another automaton, which leads to a new state.5. CSMA/CA SpecicationWe aim at modeling a WSN made up of nodes communicating through a shared medium. We give below automata templates of these components: the wireless medium, normal and compromised nodes.- 5.1. Automaton of the mediumThe role of the medium (see Fig.2(a) ) is to propagate packets between nodes. A transmission of any node may interfere with other transmissions leading to collisions. The process of a packet sending is modeled through two successive interactions between the medium and the sender whose identifier is e; that is, (beginSend[e]?; endSend[e]?) modeling respectively the start and the successful termination of a transmission of e. The delay between these two events shall depend on the duration of the packet transmission. Such a time constraint is depicted by the invariantx ≤ FtrDur on the location Transmitting in the sender node automaton (where x is a logical clock). Any intervening transmission while control is still in the locations in-between, would raise a collision (see Fig.2(a) ). Furthermore, once the medium automaton receives the beginSend[e] event its status wmStatus does not switch immediately from free to busy because it has to wait RTT delay. Meanwhile, the medium is sensed free by any inquiring node so that this increases the collision risks. The collision! event shall be raised whenever another transmission is launched (illustrated by endSend[a]? triggered by any station a) before the current transmission is finished (i.e., endSend[e]? event is not received yet).
PPT SlideLager Image(a) Wireless medium Automaton (b) UPPAAL automaton of a sensing node - 5.2. Automaton of a sane nodeThe automaton template (see Fig.2(b) ) depicts the sensing function of a node st. Note that its initial location is Idle from which the control can go to End location if all packets have been sent. Otherwise, the control goes to Testing location along with the backoff exponent BE initialized to macMinBE value if this location is entered for the first time during the transmission cycle of a same packet. Thereafter, the automaton checks whether the number of trials NB exceeds the threshold maxMacCSMABackoffs during the transmission of the current packet. In the former case, control shall be shifted to the Error location and then back to the initial location Idle. Otherwise, control moves to BackingOff where it stays therein for a duration equal to Backoff Delay. Such a time constraint is depicted by the invariant x ≤ Backoff Delay upon the location BackingOff. This delay is sampled from the adequate time interval (interval1, interval2, or interval3) depending on BE value (depicted by guards on the related arcs). Once the backoff delay elapsed, the CCA procedure is performed where the medium is sensed for some amount of time. If it is sensed busy then control moves to Testing location along with increment of the number of trials NB and the backoff exponent BE modulo a threshold aMaxBE. However, if the medium is continually sensed free for CCA Delay the automaton triggers the event beginSend[st]! to the medium automation (modeling the start of a packet transmission) and control shifts to Transmitting location where it stays for a delay equal to RTT. If a collision occurs a relating event collision? is triggered incrementing thus the number of collisions NBRcol. This makes control move to Collision location and next to Idle location after the transmission delay is elapsed. However, if endSend[st]! event is triggered after CCA delay is elapsed then this would mean a successful termination and leads control to return back to Idle location for sending a next packet. Here is the declaration of some parameters we have used in the node automaton ( Fig.2(b) ): typedef int[0; 140] interval1; typedef int[0; 300] interval2; typedef int[0; 620] interval3; const int FtrDur := 100, CCA Delay = 8; bool wmIdle, wmStatus = true; //status of the channel.- 5.3. Automaton of Greedy NodeBesides aforesaid behaviors of sane nodes, a compromised node can use false values about its NB, CCA Delay and Backoff Delay to increase its chances to firstly access the medium and send its packets according to a greedy behavior. The compromised node has the same automaton as that of the normal node ( Fig.2(b) ) but it does not behaves the same way because of the different delays and number of backoffs it uses. We give below the definition of the false parameters (i.e., time intervals and variables): typedef int[0; 70] interval1; typedef int[0; 150] interval2; typedef int[0; 310] interval3; const int CCA Delay = 4, maxMacCSMABackoffs := 10;- 5.4. The Global ModelOnce the templates are defined, we build the whole system by instantiating CompomisedNode and SaneNode templates as many times as necessary and then combining in parallel the produced processes with only one process WirelessMedium as follows: node0=SaneNode(0); node1=SaneNode(1); … nodeC0=CompromisedNode(0); … system WirelessMedium,node0,node1,…,nodeC0,…;6. ConclusionWe have presented a timed automata-based approach to model the IEEE 802.15.4 non-slotted CSMA/CA protocol of WSN which some nodes may be greedy. We intend to use in a future work model-checkers on our models to check expected properties and do performance evaluation once automata transitions are annotated with probabilities of transmission events.Alur R. , Dill D. 1994 A theory of timed automata Theoretical Computer Science Elsevier 126 183 - 235Behrmann G. , David A. , Larsen. K.G. 2004 A Tutorial on Uppaal Springer 4th Intl. School on Formal Methods for the Design of Real-Time Systems. LNCS 3185Hammal Y. , Ben-Othman J. , Mokdad L. , Abdelli A. 2014 Formal Modeling and Verication of an Enhanced Variant of the IEEE 802.11 CSMA/CA Protocol Journal of Communications and Networks 16 (4)2003 IEEE 802.15.4 Standard (2003) Part 15.4: Wireless medium access control (MAC) and physical layer (PHY) specications for Low-Rate Wireless Personal Area Networks (LRWPANs) IEEE Standard for Information Technology, IEEESA Standards Board