Dynamic GTS Scheduling of Periodic Skippable Slots in IEEE 802.15.4 Wireless Sensor Networks

Dynamic GTS Scheduling of Periodic Skippable Slots in IEEE 802.15.4 Wireless Sensor Networks

Dynamic GTS Scheduling of Periodic Skippable Slots in IEEE 802.15.4 Wireless Sensor Networks ? Tiago Semprebom ∗ Carlos Montez ∗ Ricardo Moraes ∗∗,∗∗∗...

205KB Sizes 0 Downloads 25 Views

Dynamic GTS Scheduling of Periodic Skippable Slots in IEEE 802.15.4 Wireless Sensor Networks ? Tiago Semprebom ∗ Carlos Montez ∗ Ricardo Moraes ∗∗,∗∗∗ Francisco Vasques ∗∗∗ Paulo Portugal ∗∗∗ ∗

Automation and Systems Department, Federal University of Santa Catarina, Florianopolis, Brazil ({tisemp,montez}@das.ufsc.br) ∗∗ Computer Science Department, UFSC, Florianopolis, Brazil ∗∗∗ UISPA/ISR, Faculty of Engineering, University of Porto, Porto, Portugal ({vasques, pportugal, rmoraes}@fe.up.pt) Abstract: The IEEE 802.15.4 standard offers a flexible communication solution for low-rate wireless small area networks. When the beacon mode is enabled, real-time communication is possible by using the Guaranteed Time Slots (GTS) mechanism. However, the beacon-enabled mode only supports a maximum of seven GTS allocated in each superframe, preventing other nodes to benefit from the guaranteed service. This paper introduces the SIGHT (Skips In GTS scHeduling for IEEE 802.15.4 neTworks) model, which incorporates a dynamic GTS allocation policy for IEEE 802.15.4 networks based on the (m,k)-firm task model. Our approach ensures that at least m messages are allocated in a guaranteed slot, for any k consecutive superframes. It adopts a deterministic schedulability test and an on-line prioritization heuristic algorithm called Slotted DBP (Distance Based Priority) to attend requests according to this schedulability model. A simulation model has been developed, in order to compare the behaviour in overload conditions of the proposed Slotted DBP with other approaches (DWCS and FIFO). Keywords: IEEE 802.15.4, WLAN, real-time systems, (m,k)-firm scheduling, QoS. 1. INTRODUCTION Over the last few years wireless networks are playing an important role in industrial automation and process control systems (Willig (2008)). One of the main motivations is the reduction of wiring in industrial plants, providing a substantial reduction in the installation and maintenance costs. Moreover, wireless networks make possible mobility in industrial control systems, allowing the implementation of more flexible solutions. Concerning recent industrial communication environments, big efforts are being made to move from wired to wireless networks, being Voice over IP (VoIP) and Networked Control Systems (NCS) examples of driving applications. For such type of applications, the demand for wireless networking supporting real-time communication and servicedifferentiation will significantly increase due to specific timing requirements. Within this context, the IEEE 802.11 (2003) and IEEE 802.15.4 (2006) family of protocols are the main contenders to be used in industrial wireless communications. This paper focuses on IEEE 802.15.4/ZigBee wireless sensor networks (WSNs). Typical applications of these type of networks include industrial, home and factory automation, automotive applications, control applications, agriculture, habitat monitoring, urban search and rescue, ? This work was partially funded by Brazilian research agencies CAPES, CNPq and FAPESC.

remote surveillance, motion tracking and others. A common characteristic of such applications is the existence of multiple traffic types, including periodic data, intermittent and real-time data (Low et al. (2005); Ramamurthy et al. (2007)). Basically, the IEEE 802.15.4 (2006) protocol supports two operational modes, which may be selected by a central node called PAN Coordinator: non beacon-enable mode and beacon-enable mode. The former scheme usually use CSMA/CA (Carrier Sense Multiple Access/Collision Avoidance) based MAC (Medium Access Control) operation, i.e., it employs a contention-based approach. In the latter, beacons are periodically sent by the PAN coordinator to identify its PAN and to synchronize nodes that are associated with it. This feature, combined with the use of time slots, enables the coordinator to apply a reservationbased scheme. In order to support real-time communication in WSNs, a prioritized MAC mechanism should be used for traffic differentiation. One of the most promising solutions intended to provide real-time guarantees is the Guaranteed-Time Slot (GTS) mechanism, proposed in the IEEE 802.15.4 standard. This mechanism is quite attractive, because, when the network operates in beacon-enabled mode, the bandwidth can be reserved for devices that require time guarantees. The GTS mechanism works in the Contention Free Period (CFP) of the IEEE 802.15.4 standard and, it provides a maximum service interval for devices through

fixed GTSs allocation. Therefore, it enables the prediction of the worst-case performance for each node within the network, since these GTS-enabled devices do not need to compete with others devices for transmission. One of the main drawbacks of the GTS mechanism is reduced upper bound of the number of GTS that can be shared among all nodes. According to the standard, only up to seven GTSs can be allocated during the CFP. This scarce resource can be rapidly extinguished when considering networks with larger number of nodes. As a consequence, those devices that do not have any allocated GTSs should try to accomplish their transmissions during the Contention Access Period (CAP), using the traditional contention-based CSMA/CA mechanism, which does not provide any timing guarantee. This paper extends the GTS scheduling mechanism of the IEEE 802.15.4 (2006) standard, considering a (m,k)-firm scheduling model. This technique improves the actual slot allocation scheme during the CFP, enabling more than seven devices to be granted with a guaranteed service (GTS allocation). The proposed model can be implemented upon the existing IEEE 802.15.4 medium access protocol. The main reasoning behind the work carried out in this paper is that some target applications are usually loss tolerant in what concerns the loss of some message deadlines. For instance, Networked Control Systems (NCSs) scheduled according to the (m,k)-firm model (Hamdaoui and Ramanathan (1995)) can tolerate occasional losses of periodic messages. Other examples that investigate the loss tolerant feature of supported applications have been addressed in (Hespanha et al. (2007); Lemmon et al. (2003); Schenato et al. (2007); Milln et al. (2008)). The remainder of this paper is structured as follows: In Section 2 we provide the previously relevant work. In Section 3 we presents an overview of IEEE 802.15.4 MAC protocol and its current GTS allocation mechanism. Section 4 presents a formal description of the problem. A scheduling policy to provide deterministic (m,k)-firm guarantee is discussed in Section 5. The performance evaluation results are demonstrated in Section 6. Finally, in Section 7 some conclusions are drawn. 2. RELATED WORK The problem addressed in this paper can be basically regarded as a resource scheduling in overload conditions. This problem has already been addressed in the literature, but within different contexts and assumptions. In the middle 90’s, Hamdaoui and Ramanathan (1995) introduced the notion of (m,k)-firm deadlines to schedule periodic tasks 1 in the context of soft real-time applications. The adopted task model considers that a task misses its deadline if it cannot complete its execution until the beginning of the next period (deadline equal to the period). They proposed an algorithm that uses the concept of distance to failure as the heuristic to prioritize tasks 1 The term task, in real-time context, means a resource that needs to be scheduled. In this work, a task refers to a GTS allocation request; and an execution of a task means that this task had success in its allocation request.

(DBP – Distance Based Priority). In the DBP scheme, a task in the proximity of missing more than m deadlines within a window of k service requests (k periods), receives the highest priority of the system. The authors proposed a sufficient schedulability test rather restrictive and that depends on the arrival order of the tasks, where a nonnegligible number of tasks that could be scheduled are discarded by the test. Li et al. (2004) posteriorly introduced a sufficient test (sufficient but not necessary). Similarly, the work entitled Skip-over from Koren and Shasha (1995) considers a set of periodic tasks that tolerate discards (skips). These discards are characterized by a discard parameter s, which represents the tolerance of the task for deadlines misses. The distance between two consecutive skips must be at least s periods. The work also introduces a sufficient schedulability test, where in some cases tasks are unnecessarily discarded. In Bernat and Burns (1997), a task model with (n,m)hard constraints is presented. The focus of the work is to improve the responsiveness of best effort tasks, in the presence of tasks with (n,m)-hard constraints. The proposed approach requires a schedulability test (offline test) to ensure the schedulability of tasks with hard time constraints. In Montez et al. (1999) is proposed an adaptive scheduling model called (p+i,k)-firm. The work extends the (m,k)firm model, allowing the tasks also to specify time constraints as imprecise computation. The concept of distance to failure and the allocation of priorities by the DBP algorithm were extended. In overload conditions, the heuristic is used at runtime to schedule tasks according to their distances to failure, seeking to avoid dynamic failures. West and Zhang (2004) describe an algorithm for scheduling packets in real-time multimedia data streams called Dynamic Window-Constrained Scheduling (DWCS). This algorithm considers the tolerance of these packets with respect to the deadlines violation for some activations. The window-constraint defines the number of packet deadlines that can be missed in a window of deadlines for a set of consecutive packets in a stream. The algorithm attempts to guarantee that no more than x out of a window of y deadlines are missed. West and Zhang (2004) presents a schedulability test to ensure the absence of failures. However, the presented algorithm is not exact, just sufficient. In the proposal evaluation, the authors compare the DWCS with DBP, analyzing the deadline misses and the window-constraint violations. However, the fact that DWCS uses EDF as the first criterion for tie breaks, takes the DWCS to behave like EDF when the system load is smaller or equal than 100%. Some more recent works have investigated the development of more adequate schedulability tests. In this context, Goossens (2008) proposes an exact test for applications with (m,k)-firm constraints, but the proposed schedulability test verifies all the possible combinations of the tasks set. The computational complexity of this test scheduling is viable for offline testing. However, it is not appropriate for systems with dynamic load, or where the scheduler runs on devices with hardware limitations, such as WSNs.

The pinwheel scheduling problem (Holte et al. (1989); Baruah and Lin (1998)) is also close to the one proposed in this paper. However, the pinwheel constitutes an instance of scheduling class called “distance based scheduling”. In this class of scheduling, the periodic model is slightly different from the conventional real-time task model.

and the Superframe Order (SO), respectively. The Beacon Interval is defined as follows:

Recently, the use of appropriate real-time mechanisms in wireless sensor networks is starting to be addressed. There are some works in the literature that attempts to improve the traditional GTS allocation mechanism in IEEE 802.15.4 networks. Among these works can emphasize the work presented by Koubaa et al. (2006) improves the use of bandwidth allowing multiple devices to share the same set of GTSs through a round-robin scheduling algorithm. This proposal attempts to improve the use of contention free periods (CFP), assuming that the tasks do not use the resource previously reserved in all superframes periods. However, if the nodes often request GTSs allocation with low latency, the slots would quickly disappear due to the fact that the IEEE 802.15.4 standard supports only up to seven GTSs to be simultaneously allocated. The study also assumes that the candidates sharing the same GTS have similar arrival rates.

The Superframe Duration (SD), which corresponds to the active period, is defined as follows:

Whatever the proposed scheduling approach it must always consider the hard constraint imposed by the IEEE 802.15.4 protocol, which upper bounds the number of guaranteed time slots to seven in each superframe. In this paper, we propose a dynamic GTS allocation policy, to overcome this strict upper-bound. 3. IEEE 802.15.4 OVERVIEW 3.1 IEEE 802.15.4 MAC Protocol The IEEE 802.15.4 (2006) protocol supports two operational modes, which may be selected by a central node called PAN Coordinator: (1) non beacon-enable mode: in this operation mode, devices may simply send data ruled by a non-slotted CSMA/CA approach. In this mode, the superframe structure is not implemented. (2) beacon-enable mode: in this operation mode, beacons are periodically sent by the PAN coordinator to identify its PAN and to synchronize nodes that are associated with it.

BI = aBaseSuperf rameDuration . 2BO , f or 0 ≤ BO ≤ 14

SD = aBaseSuperf rameDuration . 2SO ,

The Beacon Interval and the Superframe Duration (SD) are determined by two parameters, the Beacon Order (BO)

(2)

f or 0 ≤ SO ≤ BO ≤ 14 In Eqs. 1 and 2, aBaseSuperframeDuration denotes the minimum duration of the superframe, corresponding to SO=0. The IEEE 802.15.4 (2006) standard fixes this duration to 960 symbols (a symbol corresponds to 4 bits). This value corresponds to 15.36 ms, assuming a data rate of 250 kbps, in the 2.4 GHz ISM frequency band, which will be considered for the rest of this paper. The active portion of each superframe is composed by three parts: beacon, CAP (Contention Access Period)and CFP (Contention Free Period). The beacon shall be transmitted without contention periods (and without CSMA/CA), at the start of slot 0. The CAP must begin immediately after the beacon. The CFP, if any, follows immediately after the CAP and extend the end of the active portion of the superframe. All the allocated GTSs should be located within the CFP. If the communication mechanism exclusively uses the CAP, a device that wants to communicate must compete for the medium access using a slotted CSMA/CA approach. A device transmitting within the CAP ensures that its transaction is completed (including the reception of any acknowledgement) before the end of the CAP, or before the start of inactive period (if exist). Figure 1 illustrates a superframe structure where the Beacon Interval (BI) is twice as long as the active superframe duration (SD). There are also two allocated GTSs during the CFP. Beacon

Beacon CAP

CFP

GTS 0

1

2

3

4

5

6

7

8

(Inactive)

GTS

9 10 11 12 13 14 15 SO

SD = aBaseSuperframeDuration * 2

symbols

0 < SO < BO < 14

(Active)

In this paper, we focus on the beacon-enable mode, as this mode is specifically suited to provide timeliness guarantees to time-sensitive applications in the network. When the coordinator selects the beacon-enable mode, it forces the use of the superframe structure to manage the communication between devices associated with the PAN. The superframe is hold by a beacon interval (BI) and limited by two consecutive beacon frames, which includes an active period (divided into 16 equally-sized time slots) and an inactive period (Figure 1). The Coordinator interacts with the PAN during active periods, and all nodes may enter in a saving energy mode (sleep mode) during inactive periods.

(1)

BI = aBaseSuperframeDuration * 2

BO

symbols

Fig. 1. Superframe structure in IEEE 802.15.4 3.2 GTS Allocation The GTS (Guaranteed-Time Slot) is a portion of the superframe that is exclusively dedicated to a specific device. The GTS allows the device to access the communication medium without contention periods within the CFP. A GTS is allocated only by the PAN coordinator, and must be used only for communication between the PAN coordinator and the device associated to it. A single GTS can extend over one or more superframe slots. The

PAN coordinator may simultaneously allocate up to seven GTSs, as long as there is enough available capacity in the superframe. A GTS must be allocated before use, each GTS shall be deallocated when the GTS is no longer required, and a GTS can be deallocated at any time by the PAN coordinator or by the device that originally requested the GTS. A device that allocates a GTS, can also transmit data during the CAP interval. All transmissions in the CFP should be completed one IFS before the end of their GTS period. Figure 2 shows the GTS field format sent within an allocation request command frame by a node to the PAN coordinator. The device expresses the requested number of GTSs to be allocated in the GTS length field. The direction field specifies the data flow direction (in each GTS), data is transmitted from the PAN coordinator to the requesting node, or data is transmitted from the requesting node to the PAN coordinator. Each device selects a GTS for transmission and/or reception. The characteristics type field refers to GTS allocation (value = 1) or a GTS deallocation (value = 0). 2

1

4/10

Frame Control

Sequence Number

Addressing Fields

Bytes:

MAC header fields (7bytes)

1 Command Frame Identifier

1 GTS Characteristics

GTS request command format

Bits:

0-3

GTS Length

5

6-7

Characteristics GTS Type Direction

4

Reserved

GTS Characteristics field format

Fig. 2. GTS request frame structure. Upon receiving this request, the PAN coordinator sends an acknowledge message – to confirm the receiving of the GTS request – and checks whether there are enough time slots available in the superframe for this GTS request. If the number of available time slots in the superframe is smaller than the number of requested GTSs, it is rejected. The PAN coordinator must ensure that CAP length not be less than aMinCAPLenght = 440 symbols (equal to 220 bytes or 7.04 ms). By default, GTSs are allocated on a FIFO (First-in, Firstout) basis, and all GTS shall be placed contiguously at the end of the superframe. The PAN coordinator makes this decision within aGTSDescPersistenceTime (where aGTSDescPersistenceTime = 4) superframes. Therefore, on receipt of the acknowledge message to the GTS request, the device continue to track beacons and wait for, at most, aGTSDescPersistenceTime superframes. If no GTS descriptor for the device appears in the beacon within aGTSDescPersistenceTime time, the GTS allocation considers a failure. If the GTS request is accepted by the PAN coordinator, it generates a GTS descriptor with the requested specification. This information is located in the GTS descriptor field embedded in each beacon frame, and it is sent by the PAN coordinator. Devices that requested the GTS allocation must track the beacon frames and verify what time slots were allocated in the current superframe. A beacon frame cannot have more than seven GTS descriptors.

4. SIGHT MODEL: EXPLOITING SKIPS IN GTS SCHEDULING In this section, the proposed dynamic GTS allocation scheduling policy named SIGHT (Skips In GTS scHeduling for IEEE 802.15.4 neTworks) is presented. This allocation policy offers timing guarantees to applications with (m,k)-firm constraints by executing two algorithms in the coordinator node (IEEE 802.15.4 PAN Coordinator): (i) a deterministic schedulability test, executed when the PAN coordinator receives a GTS request; and (ii) a dynamic priority assignment policy, based on a DBP (Distance Based Priority) algorithm, executed on the start of each periodic superframe. Both algorithms cooperate to improve the current IEEE 802.15.4 GTS allocation mechanism for real-time applications. 4.1 Motivation and System Model The approach of the resources reservation adopted by some real-time systems can bring serious resource wasting problems. In the fact, most real-time systems designed in this way rarely will utilize the reserved resources. Some real-time systems can be designed considering the average use case; this approach can be suitable for systems under probabilistic deadline guarantees. Otherwise, applications in the automation and control field needs a more precise specification on how the system will satisfy the applications deadlines. The (m,k)-firm task model proposed by Hamdaoui and Ramanathan (1995) can by used to design this kind of applications. Considering an IEEE 802.15.4 network, the (m,k)-firm task model can be used for the allocation of slots in the PAN coordinator node. It is possible to consider that a task misses its deadline, if it could not transmit its message in the last superframe. Therefore, if there are more than seven GTS allocation requests arriving in PAN Coordinator, and if each request has a (m,k)-firm specification, then the PAN Coordinator can perform a scheduling in these slot requests following the (m,k)-firm constraints, trying to avoid dynamic failures. Moreover, as for hard real-time systems, schedulability analysis can be made in a new incoming request to verify its feasibility, in order to ensure a deterministic (m,k)-firm guarantee for the applications. The new incoming request must be accepted only if it will not jeopardize the guarantees offered to the others previously accepted requests. In this work, it is considered an IEEE 802.15.4 cluster composed of a set of sensor nodes in the range of a node designated as the PAN coordinator. The star topology adopted in this work (Figure 3) can be easily extended for a large-scale sensor network using clustering or two-tiered architectures. It is assumed that the PAN coordinator sets up the network determining the superframe structure through the BO (beacon order) and SO (superframe order) IEEE 802.15.4. These values are big enough enabling each node in the network to send their own messages using only one slot. Each sensor node i that wants to allocate a GTS for a specific period of time, multiple of a superframe period, sends a GTS request with their (m,k)-firm constraints to the PAN coordinator.

dev

dev

Therefore, in this paper the task model considers two important restrictions:

dev

dev

dev PAN Coordinator

PAN

(m,k)-firm constraints

SDBP

dev dev dev

...

dev dev

Fig. 3. System model in star topology. To keep the conformity with the IEEE 802.15.4 standard, the SIGHT implementation does not impose any changes to the existing protocol. However, the (m,k)-firm constraints of each device must be inserted into the message payload intended to PAN Coordinator. As the reserved field, available on GTS request frame, is formed by only 2 bits, this may be unaffordable for some applications. The main problem addressed in this paper is how the PAN coordinator must schedule the S Guaranteed Time Slots during the contention free period (CFP) among N requesting sensor nodes, respecting the quality of service constraints (m,k)-firm of each node i. Formally, the problem addressed in this paper can be stated as follows. A set with N independent periodic tasks can be represented as Γ = {τ1 , τ2 , ...τn }. Each task is non-preemptive and characterized by a 5-tuple (Ti , Di , Ci , mi , ki ), where Ti represents the task period, Di represents the task deadline, Ci represents the task worst-case execution time, mi and ki represent the (m,k)-firm constraints of a task i (1 ≤ mi ≤ ki ). In the specific case of SIGHT model, a periodic task represents an application that runs in a network node and the tasks periods are the superframe periods. In this paper, we consider the relative deadline equal to the task period, i.e. a task misses its deadline if it is not able to cannot transmit its message in the present superframe period. The worst case execution time from a task is the slot time, which is the same for all tasks. Finally, as mentioned before, mi e ki represent the (m,k)-firm constraints for τi , which mandates that at least m out any k consecutive jobs in a periodic task τi must meet their deadlines to avoid a dynamic failure condition. Considering p as the superframe period (Beacon Interval, composed of CAP, CFP and Inactive Period, if the further exists), in the system model the following assumptions are considered: • Ti = p: task periods coincide with superframe period, • Ci = 1: number of requested slots. Each node is served exactly in one time slot 2 , • Di = Ti : deadline equal to period, • (mi , ki ) ∈ Z+ , 1 ≤ m ≤ k and ki = kj (j6=i) . 2

The size of the time slots can be flexibly adjusted through the parameters Beacon Order (BO) and Superframe Order (SO).

(1) same k value: when specifying a (m,k)-firm constraint, all the tasks have the same k value; (2) same period : all tasks have the same period, that is equal to the superframe period. These restrictions allow the SIGHT model to present an exact (necessary and sufficient) schedulability test. This is a small price to pay if it is necessary to provide guarantees to more than seven tasks allocating GTS in IEEE 802.15.4 networks and/or if the system needs to perform an exact schedulability test. The general k-values problem with arbitrary service times and request periods has been shown to be NP-hard by Mok and Wang (2001). 5. SLOTTED DBP ALGORITHM The Slotted DBP algorithm (SDBP) is built upon the distance-based priority concept, which was introduced in Hamdaoui and Ramanathan (1995). In order to apply this concept, it is necessary to maintain a state that captures the recent history of the deadline accomplishment for each task. This execution history is a k-tuple that stores the k most recent task executions. Let 0 and 1 represent a deadline miss and a deadline meet, respectively. For each new state produced, the history is moved (from right to left) and the new state added to the far right position. For instance, a task with k = 3 and history “110” denotes that the most recent task missed its deadline and, the other two met their deadlines. For a task j, it is possible to get the distance to failure dj (k) following the calculation scheme proposed in Hamdaoui and Ramanathan (1995): Let metj (n, h) denote the position (from the right) of the nth meet deadline in history h. If there is less than n 1s in h, then metj (n, h) = k + 1. For instance, metj (1,“011”)=1, metj (1,“010”)=2, metj (2,“101”)=3, metj (2,“001”)=4. Then using this function, the distance to failure is given by: dj (k) ← (k − metj (m, h) + 1). Figure 4 shows the state transition diagram for a task with (2,3)-firm constraints. Thus, task j can be in one of 2kj possible states. The shaded states have less than two meets and therefore are failing states. We cannot directly apply DBP-similar approaches without considering the superframe structure, because similar approaches tend to inspect a slot window contiguously. The original DBP approach considers that a window can start in a superframe and finish in next one. For this reason, in this paper we extend the DBP usage considering the existence of the superframe structure. Slotted DBP provides (m,k)-firm guarantees for devices requesting GTS allocation in two phases. In the first phase (Algorithm 1), when a new GTS request is received by the PAN coordinator, it runs an admission test (Eq. 3). This dynamic test is performed by the PAN Coordinator on the arrival of each new GTS allocation request.   N X mi Ci ≤ 1.0 ki Ti i=1

(3)

History

111

011

d j(k)

2

2

101 110 1

001 010

1

0

0

100

000

0

0

1 0 1 1 1

111

0

101

110 0

0 1 0

100

1 0

011 010 1

0

001 1

000 0

Fig. 4. Distance to failure for (2,3)-firm task (based on Hamdaoui and Ramanathan (1995)). where N is the total number of nodes that requested a GTS allocation. If the admission test fails, i.e., if the system load exceeds 100%, the GTS allocation request is denied, because the allocation policy cannot accommodate any new GTS. But if the system utilization is less or equal than 100%, a new request can be accepted. Then, the new accepted request is inserted into the GTSs request list (list Li ) in the PAN coordinator (Algorithm 1). Algorithm 1 Admission test. 1: if a new request i arrives then  P GTS mi Ci 2: if ≤ 1 then ki Ti 3: insert request in list Li 4: admission test = feasible 5: else 6: admission test = unfeasible 7: end if 8: end if

Discarded requests by the admission test in the CFP can compete for the medium access during the CAP interval. Eventually, these requests may achieve to be successfully transmitted. The second phase of the proposed algorithm (Algorithm 2) is composed of a dynamic GTS scheduling mechanism. When a new request is accepted by the admission test, the scheduling algorithm dynamically selects which devices will be covered with guaranteed access in that specific superframe. Such a selection is based on the QoS request requirements informed by each device according to their (m,k)-firm constraints. Algorithm 2 Dynamic scheduling. 1: for all superframe period do 2: for all GTS request j do 3: calculate dj (k) 4: end for 5: sort Li in dj (k) order 6: allocate firsts GTS requests in Li on superframe empty slots 7: end for

The Slotted DBP algorithm is optimal in the sense that if some feasible schedule exists, the SDBP will also find a feasible schedule.

Finally, the upper bound one GTS slot in DBP algorithm can be relaxed. It is possible to have more than one GTS slot allocated to a node in the same superframe, and the schedulability test still being exact. Nevertheless, this means that there will be a certain level of pessimism in the GTSs usage. This pessimism can be overcome by a dynamic realignment of the GTS allocated by the PAN coordinator (covered by the standard IEEE 802.15.4 (2006)), resulting in the remaining time slots being bring forward to the CAP interval. 5.1 Informal Proof For the sake of cleaness we provide an informal correctness proof. However, it involves a reduction to an equivalent EDF scheduling algorithm problem. EDF is optimal in the sense that, if it is possible to produce a schedule in which all deadlines are met, such a schedule can be produced using EDF. The requirement that C = 1, Di = Ti and Ti = p is imposed because Slotted DBP make scheduling decisions at the granularity of the superframe. This allows SDBP to emulate the preemptive nature of EDF. If the utilization factor U > 1.0, then the task set cannot be scheduled by any algorithm (U ≤ 1.0, is a necessary condition). In the equivalent EDF schedule, we must guarantee that n periodic tasks are serviced for Ci units of time, every PN  Ci  period ki . If i=1 Ti ≤ 1.0 then EDF guarantees that all tasks will meet their deadlines. This is an exact test, that is, a necessary and sufficient test. With Slotted DBP, we require a feasible  schedule to have PN mi Ci a minimum utilization of i=1 ki Ti ≤ 1.0. This is the same utilization as that in the equivalent EDF schedule. When the utilization factor of the Slotted DBP U = 1 the algorithm schedule only the mandatory tasks, in other words, the resulting schedule will meet only mi deadlines in any request window ki . When the utilization factor is U < 1 just to schedule the mandatory requests (distance to f ailure = 1), like EDF and attend the others tasks (d > 1) in the slack of the utilization. 5.2 Example of Slotted DBP GTS Scheduling Without loss of generality and for the sake of understanding, this section presents a scheduling example for a superframe with just two GTSs, formed by one time slot each, where the CFP, CAP and inactive period (if exists) are not presented. In the illustrated example (Figure 5) there are four tasks requiring GTSs allocation. In conventional approaches only the first two devices have a successful allocation. However, these four tasks may have informed their QoS requirements as (m,k)-firm constraints, as follows: τa = (4, 4); τb = (2, 4); τc = (1, 4); τd = (1, 4). The other task parameters are Ti = Di = 2 and Ci = 1, that is, period and deadlines equal to the superframe period; and execution time equal to one slot time.

CFP

ta tb ta tb ta tc ta td ta tb ta tb ta tc ta td GTS j

...

... GTS k=4

i

GTS j

70%

k=4

Fig. 5. GTS scheduling using SDBP. Following Algorithm 2, in first superframe, distance to failures of all tasks are computed as follows: da (k) = 1, db (k) = 3, dc (k) = dd (k) = 4, and tasks τa and τb are allocated in GTS. In second superframe: da (k) = 1, db (k) = dc (k) = dd (k) = 3; tasks τa and τb are allocated (τb is choose because FIFO order). In third superframe: da (k) = 1, dc (k) = dd (k) = 2, db (k) = 3; τa and τc are allocated. In fourth superframe, da (k) = dd (k) = 1, db (k) = 2, dc (k) = 4; τa and τd are allocated. Consequently, in traditional approaches, if the schedulaPN i bility test results i=1 C Ti ≤ 1.0 is correct, all deadlines could be meet. Nevertheless, in this example, we have PN Ci i=1 Ti = 2.0, thus some deadlines would be missed. Using the SDBP algorithm, allow these four slot requests allocation to be addressed, regarding their (m,k)-firm constraints, as showed in Figure 5. Besides, this figure presents two k intervals, it is necessary just to check the scheduling feasibility until the Least Common Multiple (LCM) of k values of the tasks (in this case, one k value). 6. SIMULATION RESULTS 6.1 Simulation Conditions In order to investigate the behavior of the Slotted DBP in situations where there are multiple nodes requesting the GTS allocation, a set of simulations were carried out. We consider that the requests sent from devices to PAN Coordinator carry on (m,k)-firm constraints. The SDBP performance was compared with: • Window based scheduling (DWCS) (West and Zhang (2004)), used in scheduling tasks that tolerate discarding, according with discard parameters conveyed by the tasks as window constraints. • FIFO scheduling, currently utilized by IEEE 802.15.4 standard for GTS allocation during contention free periods. We have used a simulator built using C language. Simulations were performed considering a set of tasks (nodes) requiring slots, ranging from 7 to 21, assuming that there are only seven slots available in each superframe. Each result value obtained refers to an average of 9.000 executions, each one composed of two thousand periods (2.000 superframes). In every simulation scenario it was supposed that all tasks have the same k values. This is an important assumption, previously presented in Section 4.1, necessary for the Slotted DBP to offer a deterministic guarantee. 6.2 Dynamic Failures Varying the Utilization Factor In the first experiments, the load (utilization factor) was chosen for each simulation, while the number of tasks, m

DWCS SDBP FIFO

60%

Dynamic failures

GTS i

and k values were 9.000 times randomly generated. The k values varies from 1 to 10, and the m values from 1 to k. The utilization factor was calculated according to Eq. (3).

50% 40% 30% 20% 10% 0%

0.7

0.8

0.9

Load

1.0

1.1

1.2

Fig. 6. Dynamic failures vs utilization. Figure 6 presents the dynamic failure values vs. utilization factor (x axis in Figure 6) and Table 1 shows more information, like deadline misses. The value presented in the last column in Table 1 refers to the average number of nodes generated in the simulations. Load 0.7 0.8 0.9 1.0 1.1 1.2 1.3

Dynamic Failures SDBP DWCS FIFO 0% 0% 17.9% 0% 0% 24.5% 0% 0% 31.3% 0% 0% 35.8% 31.8% 31.4% 44.5% 48.0% 57.2% 49.7% 56.3% 81.1% 56.4%

Deadline Misses 24.9% 29.5% 35.3% 38.2% 46.6% 51.5% 57.0%

Average of Nodes 9.3 9.9 10.8 11.3 13.1 14.4 16.3

Table 1. Dynamic failures and deadline misses in different utilization factor. Figure 6 and Table 1 clearly show that both SDBP and DWCS approaches do not fail when the load is smaller or equal than 1.0 (utilization factor ≤ 100%), even when the number of admitted requests is greater than seven. Although, both DBP and DWCS approaches are inadequate in overload conditions where the load (utilization factor) is greater than 1.0. Moreover, under severe overload conditions, dynamic failures in DWCS tend to present a huge degradation. The FIFO approach is completely inadequate, even for low load conditions. 6.3 Dynamic Failures Varying the Number of Nodes In the following experiments, the number of nodes (tasks) was selected for each simulation, but the load, and the m and k parameters of each task were 9.000 times randomly generated. In every experiments only the task set with utilization factor below 1.0 was utilized, in accordance with the Admission test shown in Algorithm 1. Consequently SDBP should no present any dynamic failure. Table 6.3 summarizes the results highlighting the dynamic failures as a function of the average number of tasks admitted by the system. It can be observed that both SDBP and DWCS approaches can accept simultaneously more than seven requests simultaneously without dynamic failures. Even when the deadline misses rate reach 50% or

Nodes 7 8 9 10 11 12 13 14

Dynamic Failures SDBP / DWCS FIFO 0% 0% 0% 12.4% 0% 21.3% 0% 27.1% 0% 30.7% 0% 32.5% 0% 33.2% 0% 33.4%

Deadline Misses 0% 12.5% 22.2% 30.0% 36.4% 41.7% 46.2% 50.0%

Average Load 0.64 0.69 0.76 0.82 0.86 0.89 0.91 0.92

Table 2. Dynamic failures from different approaches considering a fixed number of nodes. more there are no dynamic failures, since system load is smaller or equal than 100%. All the above results indicate that both SDBP and DWCS approaches should not be used under overload conditions in the absence of a deterministic admission test. Although, even so, when the load is greater than 1.0, results demonstrates that Slotted DBP approach is slightly better than the FIFO approach. 7. CONCLUSIONS Considering the flexibility of some real-time applications when tolerating discards without failure, and the reduced number of guaranteed time slots available in IEEE 802.15.4, a logical way to follow is to explore the realtime constraints of this networks seeking to optimize the scarce resource utilization, such as the GTSs allocation. Unfortunately, the use of appropriate real-time mechanisms in wireless sensor networks has not been thoroughly investigated. Providing real-time guarantees in WSNs is still an open issue. This paper proposes a GTS allocation scheduling model for IEEE 802.15.4 WPANs in the beaconed mode, called SIGHT. The proposed algorithm improves the GTS allocation to time sensitive applications, ensuring that (m,k)firm requirements are meet. Experiments conducted by simulation showed improvement in the GTSs allocation to devices using the model proposed in this paper. The (m,k)-firm model adopted in the approach promotes better resource usage. The schedulability test works as an admission test mechanism, avoiding the overload of the PAN Coordinator. Furthermore, the implementation of the SIGHT model requires only minimal add-ons in IEEE 802.15.4 protocol, ensuring compatibility with the standard and with the devices that already implement this protocol. To our best knowledge, there are no any other work offering quality of service for applications that tolerate skips in WSNs, more specifically in the GTSs allocation context, as presented in this paper. REFERENCES 802.11 (2003). IEEE Standard for Information Technology - Wireless LAN Medium Access Control and Physical Layer Specification. ANSI/IEEE Std 802.11, 1999. 802.15.4 (2006). Part 15.4: Wireless Medium Access Control (MAC) and Physical Layer (PHY) Specifications for Low-Rate Wireless Personal Area Network (LRWPAN). in IEEE-SA Standards Board 802.15.4-2006.

Baruah, S.K. and Lin, S.S. (1998). Pfair scheduling of generalized pinwheel task systems. IEEE Trans. Computers, 47(7), 812–816. Bernat, G. and Burns, A. (1997). Combining (n/m)-hard deadlines and dual-priority scheduling. Proc. RTSS, 46– 57. Goossens, J. (2008). (m k)-firm constraints and dbp scheduling: impact of the initial k-sequence and exact schedulability test. 16th Int. Conference on Real-Time and Network Systems. Accepted for publication. Hamdaoui, M. and Ramanathan, P. (1995). A dynamic priority assignment technique for streams with (m,k)firm deadlines. IEEE Trans. Computers, 44(12), 1443– 1451. Hespanha, J.P., Naghshtabrizi, P., and Xu, Y. (2007). A survey of recent results in networked control systems. Proc. of the IEEE, 95(1), 138–162. Holte, R., Mok, A., Rosier, L., Tulchinsky, I., and Varvel, D. (1989). The pinwheel: A real-time scheduling problem. Proc. 22nd Hawaii Int’l Conf. System Science, 693– 702. Koren, G. and Shasha, D. (1995). Skip-over: Algorithms and complexity for overloaded systems that allow skips. Proc. RTSS, 110–117. Koubaa, A., Alves, M., and Tovar, E. (2006). i-game: An implicit gts allocation mechanism in ieee 802.15.4 for time-sensitive wireless sensor networks. 18th ECRTS, 183–192. Lemmon, M., Ling, Q., and Sun, Y. (2003). Overload management in sensor-actuator networks used for spatiallydistributed control systems. SenSys ’03, 5(7), 162–170. Li, J., Song, Y., and Simonot-Lion, F. (2004). Schedulability analysis for systems under (m,k)-firm constraints. IEEE International Workshop on Factory Communication Systems, 23–30. Low, K., Win, W.N., and Er, M.J. (2005). Wireless sensor networks for industrial environments. Conf. on Computational Intelligence for Modelling, Control and Automation, 271–276. Milln, P., Jurado, I., Vivas, C., and Rubio, F.R. (2008). An algorithm to compensate for large data dropouts in networked control systems. ETFA 2008, 105–112. Mok, A.K. and Wang, W. (2001). Window constrained real-time periodic task scheduling. In Proc. 22nd RTSS, 15–24. Montez, C., Fraga, J., Oliveira, R., and Farines, J.M. (1999). An adaptive scheduling approach in real-time corba. In The 2nd IEEE Int. Symp. on Object-oriented Real-time Distributed Computing, 301–309. Ramamurthy, H., Prabhu, B.S., and Gadh, R. (2007). Wireless industrial monitoring and control using a smart sensor platform. IEEE Sensors Journal, 7(5), 611–618. Schenato, L., Franceschetti, M., and Sastry, S.S. (2007). Foundations of control and estimation over lossy networks. Proc. of the IEEE, 95(1), 163–187. West, R. and Zhang, Y. (2004). Dynamic windowconstrained scheduling of real-time streams in media servers. IEEE Trans. on Computers, 53(6), 744–759. Willig, A. (2008). Recent and emerging topics in wireless industrial communications: A selection. IEEE Trans. on Indust. Informatics, 4(2), 102–124.