4.1 Background

Since time division multiple access (TDMA) scheduling has the high predictability, it is widely used in industrial networks [1,2,3]. In mixed-criticality industrial wireless networks, when there are not enough resources for all data packets, the low-criticality data packets have to be discarded. Hence, almost all of mixed criticality systems must support discarding strategies [4,5,6,7]. Previous works on single-criticality industrial wireless networks apply centralized TDMA methods to guarantee the real time performance and reliability of industrial wireless networks, e.g. [8,9,10,11,12,13]. However, the centralized TDMA methods are inflexible and difficult to cope with discarding.

Intuitively, two types of methods can be used to schedule data flows in mixed-criticality wireless networks. The first type is to schedule flows based on criticality monotonic priorities. The criticality monotonic scheduling assigns the higher priority to the important flows and schedules them first. However, this method considers the criticality as the temporality. Actually, they are not equivalent. Thus, the criticality monotonic scheduling algorithm is not suitable for mixed criticality systems. This has also been demonstrated in [14]. The second type is to use the algorithms that have been proposed for previous mixed-criticality systems, such as uniprocessor/multiprocessor systems [15,16,17] and networks [18,19,20], to solve our problem. However, industrial wireless networks are different from the previous systems. To guarantee the strict requirements on the real-time performance and reliability, the main problem to be solved is how to avoid the collision and interference between parallel data flows. Mixed-criticality uniprocessor/mulitprocessor systems only consider independent processors and do not have the interference between parallel tasks. Mixed criticality wired networks and IEEE 802.11-based wireless networks are based on CSMA (Carrier Sense Multiple Access) protocols, which are unacceptable by industrial wireless networks due to the unpredictability (We give more clarifications on the differences between our system and others in Sect. 4.2). Therefore, previous algorithms cannot be used without modification in mixed criticality industrial wireless networks. In this chapter, we present a holistic scheduling solution to guarantee the real time and reliability requirements of data flows in resource-constrained industrial wireless networks. Although some flexible and scalable MAC protocols [21, 22] are adopted to improve the real-time performance and reliability of networks, they are based on only local information and cannot optimize the whole network. Therefore, our scheduling method is implemented in the application layer. According to the generated schedules, each network node transmits or receives packets in the MAC (Medium Access Control) layer. The scheduling method of the application layer can manage all data flows based on global information. Thus, it can get the optimized solution.

This chapter includes the following:

First, we propose a scheduling algorithm for mixed-criticality networks. The scheduling algorithm not only implements the optimized global management for all flows, but also reserves network resources for dynamic adjustments to enhance the real time performance and reliability of important flows. It makes a trade-off between the scheduling performance and the flexibility. Performance evaluations demonstrate that the proposed scheduling algorithm outperforms existing ones.

Second, we present a schedulability analysis for the proposed scheduling algorithm. We analyze end-to-end delay for flows, and determine whether they are all schedulable. Simulation results show that our schedulability analysis is more effective than existing ones.

4.2 System Model

Industrial wireless networks must support the strict requirements on real time performance and reliability. Therefore, we consider an industrial wireless network as follows. It consists of a gateway and some devices. We use the node set N = {n 1, n 2, …} to denote these nodes. The physical layer of our industrial wireless networks is specified by the IEEE 802.15.4 protocol. It supports 16 non-overlapping channels. However, due to external interference, not all of them can be accessed all of the time. We denote the number of available channels as M (1 ≤ M ≤ 16). Our network serves the flow set F = {f 1, f 2, …}. Each element f i is characterized by < T i, Πi, χ i > . Each flow f i periodically generates a packet at its period T i, and then sends it to the destination via the routing path Πi. The relative deadline of each packet is equal to the period T i, i.e., a packet is released at the time t, and it must be delivered to its destination before the time (t + T i + 1). In industrial wireless protocols, e.g. [23, 24], periods conform to the expression

$$\displaystyle \begin{aligned} {} b \times 2^a, \end{aligned} $$
(4.1)

where a is an integer value and b is the unit-period.

To keep consistent with related works on mixed criticality systems, our network also supports two criticality levels, L-crit (Low criticality) and H-crit (High criticality). The dual-criticality model can be easily extended to multi-criticality model. If the flow f i is important, its criticality level χ i is denoted as H. Otherwise, its criticality level χ i is L. When the system is running in the normal mode without any exception, all flows are delivered to their destinations within deadlines. If important equipment has an exception, the corresponding data must be submitted frequently and via two paths to avoid faults on a single path. Thus, in our system model, the H-crit flows have two parameter sets: the L-crit parameters < T i(L), Πi(L) >  in the normal mode; the H-crit parameters < T i(H), Πi(H) >  in the exception mode, and T i(H) ≤ T i(L). Πi(L) is a path that is used by the H-crit flow in the normal mode. Πi(H) contains two paths that are used by the H-crit flow in the exception mode, and the two paths transmit the same packet to improve the reliability. In order to clearly distinguish these paths, they are denoted as \(\Pi _i(L)=\{\pi ^*_i\}\) and \(\Pi _i(H) = \{\pi ^{\prime }_i,\pi ^{\prime \prime }_i\}\). The path \(\pi ^*_i\) (and \(\pi ^{\prime }_i\), \(\pi ^{\prime \prime }_i\)) is the set of links from the source to the destination. In this chapter, we do not consider how to select routing paths. We assume all paths have been given before generating schedules. The dynamism this chapter addresses refers to using different parameters in different modes. Transmitting a packet through the j-th link of the path \(\pi ^*_i\) (or \(\pi ^{\prime }_i\), \(\pi ^{\prime \prime }_i\)) is called as the transmission \(\tau ^*_{ij}\) (and \(\tau ^{\prime }_{ij}\), \(\tau ^{\prime \prime }_{ij}\)). Each transmission has two attributes < n α, n β > , which denote the transmission’s source and destination respectively. As the constrained resources must provide enough services to H-crit flows, the L-crit flows cannot be transmitted when exceptions happen. Therefore, L-crit flows only have a parameter set < T i(L), Πi(L) > .

To improve the reliability of industrial networks, we adopt the TDMA scheme in the MAC layer. The network manager, which is connected to the gateway, assigns a time slot and a channel offset to each transmission. A transmission only is scheduled at the given time slot and on the given channel offset. Packets are generated periodically, and the schedules of corresponding transmissions have the same period. The schedules with the same period are organized within a superframe [24]. Transmitting a packet from the source to the destination has to be done in a superframe. Thus, superframes repeat themselves periodically, and then flows can be transmitted successfully. Figure 4.1a shows a simple network, which contains two flows f 1 and f 2. When the system is in normal mode, the flows use their L-crit parameters. Their periods are 8 time slots and 4 time slots, and their paths are {e 52, e 21} and {e 98, e 87, e 74, e 41}, where e ij denotes the link from the node n i to the node n j. Figure 4.1b shows their superframes with different periods. CH and TS denote Channel Offset and Time slot.

Fig. 4.1
4 diagrams labeled A, B, C, and D. A has nodes numbered from 1 through 9 connected by arrows labeled F subscript 1 and F subscript 2. B and C represent 2 tables with rows of C H 1 and C H 2 each for the first, second, and third periods of the f subscript 1 superframe, and the first and second periods of the hyper-frame. D has a table with rows of C H 1 and C H 2 for the first, second, and third periods. 3 data blocks in the C H 1 row are labeled as steal slots.

Graph routing and superframe. (a) A network. (b) Superframes with different periods. (c) A hyper-frame. (d) The flow f 2 steal slots from the flow f 1

Two types of improper schedules will lead to transmission interference, which seriously affects the network reliability. The first type, called node interference, is that more than one transmissions uses the same node at the same time slot. Each node is only equipped with one transmitter. Therefore, one node cannot serve more than one transmissions at the same time. The second type is called scheduling interference which means that more than one transmissions is scheduled at the same time slot and on the same channel. These overlapping transmissions cannot be separated. To avoid transmission interference between different superframes, we consider all superframes as a hyper-frame whose period is the lowest common multiple of all superframes. According to the period’s Expression (4.1), the hyper-period \(\mathcal {T} = LCM(T_1,T_2,\ldots ) = \max\limits _{\forall {f_i} \in F} \{ {T_i}\} \). Figure 4.1c shows the hyper-frame of the simple example. We only consider how to schedule flows in the first hyper-period, since after that, all schedules are repeated periodically. The network manager generates all schedules under two situations: Situation 1: when the network is deployed; and Situation 2: when the deployment is changed. Due to the requirement of industrial applications being fixed, the deployment is not often changed. Thus, the schedules may be generated several times, but not frequently. According to this schedule information, it obtains the working modes of each node at every time slot, and then delivers them to the corresponding nodes. For the schedules in Fig. 4.1c, from TS1 to TS4, working modes of the node n 2 are {receive, send, idle, idle}.

When a node intends to send a transmission of L-crit flows, it waits for a constant time and then listens to whether its channel is used. If the channel is used by H-crit flows, the node discards its transmission. Otherwise, the node sends the transmission. Note that although the node uses the carrier sense technique to determine whether an L-crit transmission is discarded or not, it is different from the CSMA scheme. For L-crit flows, the node performs carrier sense within time slots of the TDMA frame. If the L-crit transmission is not discarded, it is also scheduled based on the TDMA scheme. When a node intends to send a transmission of H-crit flows, it immediately sends it at the beginning of the assigned time slot. The scheduling algorithm assigns the proper time slot and channel for each transmission and prevents H-crit transmissions from interfering with other H-crit transmissions. Therefore, H-crit transmissions are sent directly without checking the channel. In this way, the H-crit flow can steal slots from L-crit flows when it needs more resources to cope with exceptions [25]. Note that the H-crit flow using H-crit parameters is not permitted to steal slots that are used by any other H-crit flows even if these H-crit flows are using L-crit parameters. Figure 4.1d shows an example of mixed-criticality schedules. The period of the H-crit flow f 1 is changed from 8 to 4, and the new path {e 56, e 63, e 31} begins to be used. In this case, there are not enough time slots. The H-cirt transmission 3 → 1 (the solid line in Fig. 4.1d) steals the resource of the L-cirt transmission 7 → 4. Based on the stealing strategy, the dynamic adjustment can be supported.

The schedulable flow set is defined as follows. When the system is in the normal mode, the flow set is schedulable if all flows characterized by L-crit parameters can hit their deadlines. When there are exceptions in the system, the flow set is schedulable if all H-crit flows can hit their deadlines no matter which parameters they are using.

4.3 Problem Statement

Based on the above system model, we describe the mixed criticality scheduling problem as follows. Given the network and the flow set F, our objective is to schedule transmissions in the time slot and channel dimensions such that the flow set is schedulable.

To explain the problem more clearly, we formulate the problem as a Satisfiability Modulo Theories (SMT) specification. The transmission \(\tau ^*_{ij}\) (and \(\tau ^{\prime }_{ij}\), \(\tau ^{\prime \prime }_{ij}\)) is assigned the \(s^*_{ij}\)-th (and \(s^{\prime }_{ij}\)-th, \(s^{\prime \prime }_{ij}\)-th) time slot and the \(r^*_{ij}\)-th (and \(r^{\prime }_{ij}\)-th, \(r^{\prime \prime }_{ij}\)-th) channel offset. Note that a transmission is scheduled periodically. Therefore, the transmission uses all of the time slots s ij + g ⋅ T i \((\forall g \in [0,\frac {\mathcal {T}}{T_i}))\) in a hyper-frame. These assignments must respect the following constraints.

  1. (a)

    Channel Offset Constraint.

    $$\displaystyle \begin{aligned} \forall f_i, \forall j \in [1,|\pi^*_i|], 1 \le r^*_{ij} \le M \end{aligned}$$

    For each transmission, its assigned channel offset must be in M available channels. This expression is for transmissions in the path \(\pi ^*_i\). Other transmissions \(\tau ^{\prime }_{ij}\) and \(\tau ^{\prime \prime }_{ij}\) in paths \(\pi ^{\prime }_i\) and \(\pi ^{\prime \prime }_i\) have the same constraint, and we omit them for simplicity.

  2. (b)

    Releasing Sequence Constraint.

    $$\displaystyle \begin{aligned} \forall f_i, \forall j \in [1,|\pi^*_i|-1], s^*_{i,j} < s^*_{i,j+1} \end{aligned}$$

    In a routing path, the transmission τ i,j+1 is released after the transmission τ i,j is scheduled. We still omit paths \(\pi ^{\prime }_i\) and \(\pi ^{\prime \prime }_i\).

  3. (c)

    Real Time Constraint.

    $$\displaystyle \begin{aligned} \forall f_i, 1 \le s^*_{i,|\pi^*_i|} \le T_i(L) \end{aligned}$$

    All transmissions cannot miss deadlines. Likewise, \(s^{\prime }_{i,|\pi ^{\prime }_i|}\) and \(s^{\prime \prime }_{i,|\pi ^{\prime \prime }_i|}\) have the same constraint.

  4. (d)

    Interference Constraint. Assigning resources to transmissions must prevent the happening of node interference and scheduling interference. We use δ(τ a, τ b) to denote whether there exists interference between τ a and τ b,

    $$\displaystyle \begin{aligned} \delta(\tau_a,\tau_b)=(\tau_a \cap \tau_b=\emptyset) ? (\eta(s_a,s_b) \wedge (r_a = r_b)) : \eta(s_a,s_b), \end{aligned}$$

    where \(\eta (s_a,s_b)= \bigvee\limits _{\forall h \in [0,\frac {\mathcal {T}}{T_a}), \forall k \in [0,\frac {\mathcal {T}}{T_b})} (s_a + h \cdot T_a = s_b + k \cdot T_b)\) means whether the assigned time slots of τ a and τ b overlap each other. If the two transmissions do not use the same node, i.e., τ a ∩ τ b = ∅, then they can be scheduled at different time slots or on the different channel offsets. Otherwise, there exists node interference and they cannot be scheduled at the same time slot. The transmissions of the H-crit flow f i are classified into three sets \(\Gamma ^*_i=\{\tau ^*_{ij}|\forall j \in [1,|\pi ^*_i|]\}\), \(\Gamma ^{\prime }_i=\{\tau ^{\prime }_{ij}|\forall j \in [1,|\pi ^{\prime }_i|]\}\) and \(\Gamma ^{\prime \prime }_i=\{\tau ^{\prime \prime }_{ij}|\forall j \in [1,|\pi ^{\prime \prime }_i|]\}\). For the L-cirt flow f i, \(\Gamma ^{\prime }_i = \Gamma ^{\prime \prime }_i = \emptyset \), and then \(\forall f_i \in F, \Gamma _i = \Gamma ^*_i \cup \Gamma ^{\prime }_i \cup \Gamma ^{\prime \prime }_i\). Thus, the interference constraints in the normal mode and exception mode are as follows.

    1. (d.1)

      Normal mode

      $$\displaystyle \begin{aligned} \forall \tau_a,\tau_b \in \bigvee \limits_{\forall f_i \in F} \Gamma^*_i, \delta(\tau_a,\tau_b)=0 \end{aligned}$$
    2. (d.2)

      Exception mode

      $$\displaystyle \begin{aligned} \forall f_i, f_g \in F, \chi_i = \chi_g = H, \forall \tau_a \in \Gamma_i, \forall \tau_b \in \Gamma_g, \delta(\tau_a,\tau_b) = 0 \end{aligned}$$

The mixed criticality scheduling problem is NP-hard [26]. Our SMT specification can be solved by some solvers, such as Z3 [27] and Yices [28]. These solvers can find satisfying assignments for quite many problems, and their solutions have been an excellent standard to evaluate the effectiveness of other methods [29]. However, the running time may be unacceptable for complex networks and flow sets. Therefore, we propose a heuristic scheduling algorithm in Sect. 4.4 to solve the problem.

4.4 Scheduling Algorithm

In this section, we first introduce how to schedule transmissions, and then, based on these schedules, we determine working modes of each node at every time slot.

4.4.1 A Slot-Stealing Scheduling Algorithm

We propose a slot-stealing scheduling algorithm based on RM (StealRM). The proposed StealRM optimizes the solution according to the global information, and permits transmissions to share the same resource when the transmissions have different levels of criticality. Hence, the schedules can be adaptively adjusted based on the requirements of H-crit flows.

The proposed StealRM is shown in Algorithm 4.1. Each flow is assigned as the RM priority. If two flows have the same RM priority, the flow with the smaller ID has the higher priority. The transmission’s priority is equal to its flow’s priority. The set R contains all of schedulable transmissions (lines 1 and 19), and the set R′ denotes released transmissions at the current time slot (line 3). At every time slot t, we first sort elements of R′ according to the decreasing order of priorities, and τ 1 in the set R′ has the highest priority (line 4). Then, for each transmission τ a in the set R′, we check whether it can be scheduled at the current time slot without any interference (lines 7–23). Let \(\mathcal {F}(\tau _a)\) denote the flow that the transmission τ a belongs to (line 6). The set \(Y^{HL}_t\) contains the transmissions that have been scheduled at the time slot t and belong to H-crit flows with L-crit parameters. The sets \(Y^H_t\) and \(Y^L_t\) correspond to those in H-crit flows with H-crit parameters and L-crit flows, respectively. The transmissions in the set Y and the transmission τ a cannot steal slots from each other. According to the criticality level of τ a, the set Y is assigned different transmissions (lines 7–13). If the transmission τ a belongs to an H-crit flow with H-crit parameters, then it cannot steal slots from other H-crit transmissions (lines 7–8). Y H and Y HL may contain the transmissions belonging to the same flow with τ a. These transmissions do not interfere the scheduling of τ a. Thus, the set \(\{\forall \tau ^*_{ig}\}\) needs to be excluded from Y H and Y HL (line 8). Similarly, if the transmission τ a belongs to an H-crit flow with L-crit parameters, then it cannot steal slots from any other transmissions (lines 9 and 10). If the transmission τ a belongs to an L-crit flow, then its slots cannot be stolen by L-crit flows and H-crit flows with L-crit parameters (lines 11 and 13). When there is no node interference between τ a and Y, and at least one channel is idle (line 14), the transmission τ a can be scheduled at this current time slot. Θ(Y) denotes the channels that have been used by Y. However, if the current time slot has exceeded its deadline, the flow set is unschedulable (lines 15 and 16). Otherwise, the time slot and channel offset of the transmission τ a are assigned (line 18), and the schedulable transmission set R and the scheduled transmission set \(Y^H_t\) (\(Y^L_t\) and \(Y^{HL}_t\)) are updated (lines 19–26).

Algorithm 4.1 StealRM

The number of iterations of the for loop in line 2 and the for loop in line 5 is \(O(|\mathcal {T}|)\) and O(| Γ|), respectively. The complexity of line 4, line 14 and line 21 is O(| Γ|log| Γ|), O(| Γ|) and \(O(\frac {\mathcal {T}}{T_{min}})\), respectively. Therefore, the time complexity of Algorithm 4.1 is \(O(|\mathcal {T}||\Gamma |{ }^2\frac {\mathcal {T}}{T_{min}})\).

4.4.2 Node Working Mode

Nodes have three working modes, including transmit mode (\(\mathbb {S}\)), receive mode (\(\mathbb {R}\)) and idle mode. We use \(w^H_{\alpha ,t} = <\mathbb {S} \text{ (or }\mathbb {R}),r_a>\) to denote that at the time slot t the node n α transmits (or receives) H-crit flows on the channel r a. Similarly, \(w^L_{\alpha ,t}\) denotes that the node n α serves L-crit flows. Algorithm 4.2 determines the working mode for each node. For each transmission, we have assigned a time slot and a channel offset in Algorithm 4.1. According to the assignments, the working modes of the sender node and receiver node of the transmission can be obtained (lines between 4 and 10). The time complexity of Algorithm 4.2 is \(O(|\Gamma |\frac {\mathcal {T}}{T_{min}})\).

Algorithm 4.2 Working mode

Note that a node may serve two flows at the same time slot, but the two flows must have different criticality levels. Otherwise, node interference occurs. At the beginning of the time slot t, the node works in mode \(w^H_{\alpha ,t}\). Then, in a constant time if it needs to send an H-crit flow or has received a flow, it continues working in the same mode at this time slot. Otherwise, it works in mode \(w^L_{\alpha ,t}\). However, when its mode \(w^L_{\alpha ,t}\) is \(\mathbb {S}\), it must determine whether the assigned channel is clear or not before it sends the flow. If the channel has been occupied by H-crit flows, the flow has to be discarded. The switch time between different modes is very short compared with a time slot. For example, the switch time of the transceiver CC2420 is just 200 μs while a time slot is 10 ms. Generally, at a time slot, most nodes only serve one flow or are idle, while only a few nodes serve two flows.

4.5 Scheduling Analysis

In this section, we analyze the worst case end-to-end delay for each flow and use the delay to test the schedulability of the flow set. If the worst case delay of all flows does not exceed deadlines, the flow set is schedulable. For the sake of simplicity, we first explain how to compute the worst case delay in single-criticality networks (in Sect. 4.5.1) and then extend it to mixed-criticality networks (in Sect. 4.5.2).

4.5.1 Analyzing Method for Single-Criticality Networks

Besides transmitting time, the end-to-end delay is introduced by the interference from higher priority flows. Therefore, in Sect. 4.5.1.1, we present the analyzing method of the total interference. In Sect. 4.5.1.2 we distinguish the different types of interference and compute the worst case delay.

4.5.1.1 Total Interference

During the time interval between the release and completion of the flow f k, all the active transmissions that belong to the higher priority flows may have node interference or scheduling interference to the flow f k. Therefore, in the worst case, the total interference is equal to the number of those higher-priority transmissions. The method of computing the workload in a period has been proposed in multiprocessor systems [30]. The mapping between the multiprocessor system model and the network model has been explained in the work [31], in which a channel corresponds to a processor and a flow is scheduled as a task. Therefore, we propose our analyzing method based on the work [30], which is the start-of-the-art analysis for multiprocessor systems. To make this chapter self-contained, we first simply introduce the method of multiprocessor systems, and then present our method.

For the simplicity of expression, the multiprocessor system uses the same notations as our network model. For multiprocessor systems, the calculation of the worst case delay of the task f k is based on the level-k busy period (as shown in Definition 4.1).

Definition 4.1 (Level-k Busy Period for Multiprocessor Systems)

The level-k busy period is the time interval [t 0, t k), in which t k is the finish time of the task f k, and t 0 satisfies the following conditions:

  1. 1.

    t 0 < t r where t r is the release time of the task f k.

  2. 2.

    t ∈ [t 0, t r], at the time t, all processors are occupied by higher-priority tasks.

  3. 3.

    t < t 0, ∃t′∈ [t, t 0], at the time t′, at least one processor is occupied by lower-priority tasks.

If there is no t 0 that satisfies all conditions, then t 0 = t r.

The level-k busy period is determined by the workload of all higher-priority tasks. The set \(\bar {P}(f_k)\) contains the tasks with higher priority than the task f k. If the task f i (\(f_i \in \bar {P}(f_k)\)) has a job that is released earlier than the level-k busy period and its deadline is in the busy period, then the task f i has the carry-in workload in the level-k busy period. Otherwise, the task has no carry-in workload. The two types of workload are presented as follows, and the length of the level-k busy period is x.

  1. 1.

    In the level-k busy period, if the task f i has no carry-in workload, the upper bound of its workload is

    $$\displaystyle \begin{aligned} W^{NC}_k(f_i,x) = \left\lfloor\frac{x}{T_i}\right\rfloor \cdot c_i + \min\{x\mod T_i, c_i\}, \end{aligned}$$

    where c i is the execution time of the task f i.

  2. 2.

    If the task f i has the carry-in workload, the upper bound of its workload is

    $$\displaystyle \begin{aligned} W^{CI}_k(f_i,x) = \left\lfloor\frac{\max\{x-c_i,0\}}{T_i}\right\rfloor \cdot c_i + c_i + \alpha, \end{aligned}$$

    where \(\alpha = \min \{\max \{\max \{x-c_i,0\}-(T_i - D_i),0\},c_i-1\}\) and D i is the worst case delay of the task f i.

Based on the upper bounds of workload, two types of interference of the task f i to the task f k are as follows:

$$\displaystyle \begin{aligned} I^{NC}_k(f_i,x) = \min\{\max\{W^{NC}_k(f_i,x),0\},x - c_k +1\}, \end{aligned}$$
$$\displaystyle \begin{aligned} I^{CI}_k(f_i,x) = \min\{\max\{W^{CI}_k(f_i,x),0\}, x - c_k + 1\}. \end{aligned}$$

Therefore, the total interference suffered by the task f k is

$$\displaystyle \begin{aligned} \Omega_k(x,\bar{P}^{NC}(f_k),\bar{P}^{CI}(f_k)) = \sum \limits_{\forall f_i \in \bar{P}^{NC}(f_k)} I^{NC}_k(f_i,x) + \sum \limits_{\forall f_i \in \bar{P}^{CI}(f_k)} I^{CI}_k(f_i,x), \end{aligned}$$

where \(\bar {P}^{NC}(f_k)\) and \(\bar {P}^{CI}(f_k)\) denotes the set of tasks without carry-in workload and the set of tasks with carry-in workload, respectively. In a busy period, at most M − 1 higher-priority tasks have carry-in workload. Therefore, the set \(\bar {P}^{CI}\) contains M − 1 tasks that have maximal values of \(I^{CI}_k(f_i,x) - I^{NC}_k(f_i,x)\). Other tasks are in the set \(\bar {P}^{NC}\).

In the following, we propose our analyzing method. Industrial wireless networks apply strict periodic schedules based on superframes, which can reduce system complexity and run time overhead. While in multiprocessor systems and previous works about wireless networks, schedules are variable, i.e., the assigned time slots to a task (or a flow) are non-periodic, so our workload bounds are not the same as previous ones. Our workload bounds are computed with Theorem 4.1. Definition 4.2 defines the level-k busy period in the network.

Definition 4.2 (Level-k Busy Period for Networks)

The level-k busy period is the time interval [t 0, t k), in which t k is the finish time of the flow f k and t 0 satisfies the following conditions:

  1. 1.

    t 0 < t r where t r is the release time of the flow f k.

  2. 2.

    t ∈ [t 0, t r], at the time t, all channels are occupied by higher-priority flows or there exists node interference between the scheduled flows and the flow f k.

  3. 3.

    t < t 0, ∃t′∈ [t, t 0], at the time t′, there is no node interference and at least one channel is occupied by lower-priority flows or idle.

If there is no t 0 that satisfies all conditions, then t 0 = t r.

Theorem 4.1

The workload bounds can be computed with

$$\displaystyle \begin{aligned} {} W^{NC}_k(f_i,x) = W^{CI}_k(f_i,x) = \left\lfloor\frac{x}{T_i}\right\rfloor \cdot c_i + \min\{x \mod T_i, c_i\}, \end{aligned} $$
(4.2)

where c i is the number of hops in the path π i , i.e. c i = |π i|.

Proof of Theorem 4.1

The computation of the non-carry-in workload \(W^{NC}_k(f_i,x)\) is shown in Fig. 4.2a. There are \(\left \lfloor \frac {x}{T_i}\right \rfloor \) complete periods and a scheduling window (xmodT i). In the scheduling window, at most c i workloads exist. Therefore, the expression of the non-carry-in workload is shown as Eq. (4.2).

Fig. 4.2
2 diagrams labeled A and B. A has three equal segments of T subscript i with 6 boxes on a horizontal line labeled as time with x length. B has four equal segments of T subscript i with eight boxes on a horizontal line labeled as time with x length.

Illustration of Theorem 4.1. (a) \(W^{NC}_k(f_i,x)\). (b) \(W^{CI}_k(f_i,x)\)

In the following, we compute \(W^{CI}_k\) as shown in Fig. 4.2b. The notations A and B denote the two incomplete periods, respectively. We know that A < T i, B < T i and A + B = (xmodT i) or (xmodT i + T i). We discuss the two cases as follows.

Case 1: A  +  B  =  x mod T i We draw out the windows A and B in Fig. 4.3a. We consider four different value ranges of the windows A and B as shown in Table 4.1, in which if A ≥ T i − D i and B ≥ D i, it is Case 2. If A < T i − D i, then there is no workload in A. If B ≥ D i, then all execution time c i must be the available workload. In this case, the workload can also be expressed as \(\min \{B,c_i\}\). Therefore, only if A < T i − D i, the workload is \(\min \{B,c_i\}\). If A ≥ T i − D i and B < D i, the time interval T i − D i does not contain any workload. Therefore, the available window A + B is equal to (xmodT i) − (T i − D i).

Fig. 4.3
2 diagrams labeled A and B. A has 2 boxes on a horizontal line with a distance of B and A respectively. The entire distance is marked as T subscript i, and the distance from B to the edge of the second box is labeled as D subscript i. B has 2 boxes on a horizontal line with a distance of B and A respectively. The entire distance is marked as T subscript i, and the distance from the middle of B to the middle of A is labeled as x mod T subscript i.

Computation of \(W^{CI}_k\). (a) A + B = xmodT i. (b) A + B = xmodT i + T i

Table 4.1 The workload in the incomplete period under different value ranges of A and B

In Case 1, we can get that the total workload is

$$\displaystyle \begin{aligned} {} \left\lfloor\frac{x}{T_i}\right\rfloor \cdot c_i + C1. \end{aligned} $$
(4.3)

The notation C1 denotes the workload in the incomplete period as shown in Table 4.1. It is equal to \(\min \{B,c_i\}\) or \(\min \{x \mod T_i - (T_i - D_i),c_i\}\).

Case 2: A  +  B  =  x mod T i  +  T i , which is shown in Fig. 4.3 b In this case, there are \(\left \lfloor \frac {x-T_i}{T_i}\right \rfloor \) complete periods. In the windows A and B, at most \(c_i + \min \{x \mod T_i, c_i\}\) workloads exist. Therefore, the workload of Case 2 is

$$\displaystyle \begin{aligned} \left\lfloor\frac{x-T_i}{T_i}\right\rfloor \cdot c_i + c_i + \min \{x \mod T_i, c_i\} \end{aligned}$$
$$\displaystyle \begin{aligned} {} \Rightarrow \left\lfloor\frac{x}{T_i}\right\rfloor \cdot c_i + \min \{x \mod T_i, c_i\}.\end{aligned} $$
(4.4)

Comparing with Eqs. (4.3) and (4.4), the upper bound of workload is Eq. (4.4). Since (xmodT i) is not less than B and (xmodT i) − (T i − D i), equation (4.4) is the same as Eq. (4.2). The theorem holds. □

Due to the two types of workload having the same computing formula, we do not distinguish them in the following and use W k(f i, x) to denote them. Based on the workload bound, the interference of the flow f i to the flow f k is

$$\displaystyle \begin{aligned} I_k(f_i,x) = \min\{\max\{W_k(f_i,x),0\},x-c_k + 1\}. \end{aligned}$$

Thus, the total interference suffered by the flow f k is

$$\displaystyle \begin{aligned} \Omega^{total}_k(x,\bar{P}(f_k)) = \sum \limits_{\forall f_i \in \bar{P}(f_k)} I_k(f_i,x). \end{aligned}$$

4.5.1.2 Worst Case Delay in Single-Criticality Networks

\(\Omega ^n_k(x,\bar {P}(f_k))\) and \(\Omega ^s_k(x,\bar {P}(f_k))\) denote node interference and scheduling interference suffered by the flow f k in the level-k busy period. If there exists a node interference at a time slot, the flow f k cannot be transmitted at this time slot, no matter how many channels are idle, i.e., the flow f k is delayed one time slot due to the node interference. However, only when M transmissions are scheduled at a time slot, does the flow f k suffer scheduling interference and is delayed for one time slot. In the worst case, all the node interference and scheduling interference will introduce a delay to the flow f k. Therefore, the worst case delay is

$$\displaystyle \begin{aligned} {} \Omega^n_k(x,\bar{P}(f_k)) + \left\lfloor\frac{\Omega^s_k(x,\bar{P}(f_k))}{M}\right\rfloor + c_k. \end{aligned} $$
(4.5)

From Eq. (4.5), we know that node interference introduces more delay. Since the sum of node interference and scheduling interference is \(\Omega ^{total}_k(x,\bar {P}(f_k))\), so when as much as possible node interference occurs, the end-to-end delay is the worst case.

The upper bound of node interference introduced by h consecutive hops of the flow f i to the flow f k is computed as

$$\displaystyle \begin{aligned} {R_{k,i}}(h) = \mathop {\max }\limits_{\forall a \in [1,{c_i} - h]} \{ |\{ {\tau _{iy}}|\forall {\tau _{iy}},y\in[a,a+h],\exists {\tau _{kz}} \text{ such that } {\tau _{iy}}\cap{\tau _{kz}} \ne \emptyset\} |\}. \end{aligned}$$

Thus, the workload introduced by transmissions that have node interference is

$$\displaystyle \begin{aligned} W^n_k(f_i,x) = \left\lfloor\frac{x}{T_i}\right\rfloor \cdot R_{k,i}(c_i) + R_{k,i}(\min\{x \mod T_i,c_i\}). \end{aligned}$$

Then,

$$\displaystyle \begin{aligned} I^n_k(f_i,x) = \min\{\max\{W^n_k(f_i,x),0\},x-c_k+1\}, \end{aligned}$$

and

$$\displaystyle \begin{aligned} \Omega^n_k(x,\bar{P}(f_k)) = \sum \limits_{\forall f_i \in \bar{P}(f_k)} I^n_k(f_i,x). \end{aligned}$$

Then, we can get that the worst case delay of the flow f k in the single-criticality network is

$$\displaystyle \begin{aligned} D_k = \Omega^n_k(x,\bar{P}(f_k)) + \left\lfloor\frac{\Omega^{total}_k(x,\bar{P}(f_k))-\Omega^n_k(x,\bar{P}(f_k))}{M}\right\rfloor + c_k. \end{aligned}$$

From the definition of the level-k busy period, we know that the length x is the upper bound of the delay D k (shown in Theorem 4.2).

Theorem 4.2

For the flow f k and the level-k busy period, the following holds:

$$\displaystyle \begin{aligned} x \ge D_k. \end{aligned}$$

Proof of Theorem 4.2

We assume by contradiction that x < D k. From the definition of the level-k busy period (Definition 4.2), we know that the finish times of the busy period and the flow f k are the same, and t 0 must be less than (the first condition) or equal to t r (when t 0 does not satisfy at least one condition). If x < D k, then t r < t 0 as shown in Fig. 4.4. It is not consistent with the definition. The above assumption does not hold. □

Fig. 4.4
Three rectangular boxes on a horizontal line are labeled C subscript k. The entire distance from t subscript r to t subscript k is labeled as D subscript k. And a secondary distance from t subscript 0 to t subscript k is labeled as x.

Illustration of Theorem 4.2

According to Theorem 4.2, the solution of Eq. (4.6) is the upper bound of end-to-end delay D k.

$$\displaystyle \begin{aligned} {} x = \Omega^n_k(x,\bar{P}(f_k)) + \left\lfloor\frac{\Omega^{total}_k(x,\bar{P}(f_k))-\Omega^n_k(x,\bar{P}(f_k))}{M}\right\rfloor + c_k \end{aligned} $$
(4.6)

Equation (4.6) can be solved by the iterative fixed point search [32]. The iterative calculation of x starts with x = c k; until the value of x does not change.

4.5.2 Mixed-Criticality Scheduling Analysis

In dual-criticality networks, there are three types of worst case delay.

  1. 1.

    \(D^L_k\): the worst case end-to-end delay of the L-crit flow.

  2. 2.

    \(D^{HL}_k\): the worst case end-to-end delay of the H-crit flow with the L-crit parameter.

  3. 3.

    \(D^H_k\): the worst case end-to-end delay of the H-crit flow with the H-crit parameter

We use D(x, Q, c) to denote \(\Omega ^n_k(x,Q) + \left \lfloor \frac {\Omega ^{total}_k(x,Q)-\Omega ^n_k(x,Q)}{M}\right \rfloor + c\). The methods of computing these types of delays are similar. The only difference is that higher-priority flows they suffered are different, i.e., their interference sets Q are different. H-crit flows have multiple paths. These paths suffer different interference and cause different delays. Therefore, we use sub-flows \(f^*_k\), \(f^{\prime }_k\) and \(f^{\prime \prime }_k\) to distinguish them.

If there are H-crit flows with H-crit parameters in networks, L-crit flows can be discarded. Therefore, when we compute the delay \(D^L_k\), all flows have L-crit parameters. Thus, \(D^L_k = D (x,Q^L_k,c^*_k)\), where \(Q^L_k = \{f^*_i|\forall f^*_i,T_i(L)<T_k(L)\}\) and \(c^*_k = |\pi ^*_k|\).

Similarly, for H-crit flows with L-crit parameters, the interference set is \(Q^{HL}_k = \{f^{\prime }_i,f^{\prime \prime }_i|\forall f^{\prime }_i, \forall f^{\prime \prime }_i,\chi _i = H, T_i(H)<T_k(L)\} \cup \{f^*_i|\forall f^*_i, T_i(L)<T_k(L)\}\). Thus, \(D^{HL}_k=D(x,Q^{HL}_k,c^*_k)\), where \(c^*_k = |\pi ^*_k|\).

An H-crit flow with its H-crit parameter suffers the interference from H-crit flows with H-crit parameters. The H-crit flow has two sub-flows \(f^{\prime }_k\) and \(f^{\prime \prime }_k\). For these sub-flows, their interference set is \(Q^H_k = \{f^{\prime }_i,f^{\prime \prime }_i|\forall f^{\prime }_i, \forall f^{\prime \prime }_i,\chi _i = H, T_i(H)<T_k(H)\} \cup \{f^*_i|\forall f^*_i, \chi _i=H, T_i(L) < T_k(H)\}\) and \(c^{\prime }_k = |\pi ^{\prime }_k|\), \(c^{\prime \prime }_k = |\pi ^{\prime \prime }_k|\). Thus, \(D^{\prime H}_k = D(x,Q^H_k,c^{\prime }_k)\) and \(D^{\prime \prime H}_k = D(x,Q^H_k,c^{\prime \prime }_k)\), and then \(D^H_k = \max \{D^{\prime H}_k,D^{\prime \prime H}_k\}\).

According to the above delays, the schedulability test is as follows. For the L-crit flow f k, if \(D^L_k \le T_k(L)\), it is schedulable; otherwise, unschedulable. For the H-crit flow f k, if \(D^{HL}_k \le T_k(L)\) and \(D^H_k \le T_k(H)\), it is schedulable; otherwise, unschedulable. If all flows in a flow set are schedulable, the set is schedulable.

4.6 Performance Evaluations

In this section, we conduct experiments to evaluate the performance of our proposed methods.

4.6.1 Scheduling Algorithm

We consider three comparison methods: (1) SMT uses the Z3 solver [27], which is a high-performance solver being developed at Microsoft Research and whose solution has been regarded as an excellent standard, to solve our SMT specification (Sect. 4.3); (2) noStealRM applies the RM priority and does not allow slots to be stolen; (3) StealCM allows slots to be stolen and applies the criticality monotonic priority. Our method is StealRM. The performance metric we used is the Schedulable ratio, which is defined as the percentage of flow sets for which a scheduling algorithm can find a schedulable solution.

We randomly generate a number of test cases to evaluate these methods. For each test case, the number of channels M and the number of nodes |N| are given. According to the suggestion in the work [33], these nodes are placed randomly in the square area A, and \(A = \frac {|N|d^2\sqrt {27}}{2 \pi }\), where the transmitting range d is 40 meters. Except for the gateway, each node has a data flow from itself to the gateway or vice versa. There are two necessary schedulability conditions for flow sets: (1) the network utilization U is not larger than 1; (2) the utilization of each node is not larger than 1. If a flow set does not satisfy the two conditions, it cannot be scheduled. Thus, in order to make flow sets available, we specify the network utilization U(U < 1), and use the method UUniFast [34] to assign the utilization u i for each flow, where \(U= \sum\limits _{\forall f_i \in F}{u_i}\). Then, if the flow set can satisfy condition (2), it is an available flow set. Otherwise, discard it, and repeat the process until an available set is found. The period of each flow can be obtained according to \(T_i = \frac {c_i}{u_i}\). The high-crit probability of the flows is controlled by the parameter ρ. Routing paths are selected randomly.

In order to make test cases solvable by the Z3 solver, the parameters are set as ρ = 0.3, M = 2 and U = 0.8. For each configuration, 100 test cases are checked using the four algorithms. Figure 4.5 shows their schedulable ratios. Our algorithm StealRM is close to the result of Z3. In these simple test cases, the method StealCM has similar results with our algorithm StealRM. Figure 4.6 shows the average execution time of solvable test cases in Fig. 4.5. When the number of nodes is 25, the execution time of the method SMT is about 16.5 minutes. We also use the method SMT to solve the network with 30 nodes, but cannot get the result within 3 hours. Except for the method SMT, the execution time of other methods is not more than 10 milliseconds. Therefore, from the perspective of execution time, heuristic algorithms are significantly more efficient than the method SMT.

Fig. 4.5
A multi-line graph of schedulable ratio versus the number of nodes plots S M T, Steal R M, Steal C M, and no Steal R M. S M T, Steal C M, and Steal R M overlap and follow a constant trend, whereas no Steal R M follows a decreasing trend.

Schedulability comparison among all methods

Fig. 4.6
A multi-line graph of execution time versus the number of nodes plots S M T, Steal R M, Steal C M, and no Steal R M. Steal C M, Steal R M, and no Steal R M overlap and follow an increasing trend same as S M T.

Execution time comparison among all methods

Since the execution time of the method SMT is too long, the following experiments do not contain it. Figure 4.7 shows the schedulable ratios of the three scheduling algorithms. For each point in the figure, 500 test cases are randomly generated. From the figure, we can know that our algorithm StealRM has the highest schedulable ratio no matter with which parameters, while the algorithm noStealRM has the worst result. Therefore, the stealing mechanism can significantly improve the algorithm’s performance. Our algorithm StealRM has better performance than the algorithm StealCM, especially when the node numbers are higher. This demonstrates that: (1) the priority should correspond to the urgency, but not the importance, while the stealing mechanism reflects the importance; (2) the urgency and the importance have to be distinguished, except in very small networks. Comparing these subfigures, we observe that schedulable ratios decrease with the increases of ρ, |N|, U and M. The reasons are as follows. An H-crit flow can be regarded as two L-crit flows. Thus, a larger value of the parameter ρ leads to more flows, which are hard to schedule. A test case contains |N|− 1 flows. Likewise, the larger |N| makes scheduling hard. The network utilization U corresponds to the network workload. Heavy workloads lead to scheduling failures. Note that compared with Fig. 4.7a, d has three additional channels, but its schedulable ratios decrease. Because the two subfigures generate test cases according to the respective numbers of channels. Their test cases are different. Although the number of channels increases, the utilization is not changed. When the utilization U is constant, with the increase of the number of channels M, the packets that need to be transmitted increase. The increased packets will introduce more interference, which has a negative impact on the scheduling performance. Therefore, Fig. 4.7d has a lower schedulable ratio than Fig. 4.7a.

Fig. 4.7
4 multi-line graphs A, B, C, and D of schedulable ratio versus the number of nodes plots Steal R M, Steal C M, and no Steam R M. All the graphs follow a decreasing trend with dips.

Schedulability comparison among StealRM, StealCM and noStealRM. (a) M = 6, U = 0.5, ρ = 0.3. (b) M = 6, U = 0.5, ρ = 0.4. (c) M = 6, U = 0.6, ρ = 0.3. (d) M = 9, U = 0.5, ρ = 0.3

Figure 4.8 shows the average execution time of Fig. 4.7. As the results are similar, we only show two subfigures for Fig. 4.7a, d. Compared with our algorithm StealRM, the algorithms StealCM and noStealRM need more time to find feasible solutions. Therefore, their execution time slightly increases. From the figure, we know that our algorithm StealRM does not introduce extra time costs. For the three algorithms, the execution time increases with the increase of the number of nodes, since more data flows need to be scheduled.

Fig. 4.8
2 multi-line graphs A and B of execution time versus the number of nodes plots Steal R M, Steal C M, and no Steam R M. All the lines overlap and follow an increasing trend.

Average execution time. (a) M = 6, U = 0.5, ρ = 0.3. (b) M = 9, U = 0.5, ρ = 0.3

4.6.2 Analyzing Method

The comparison method is SingleAna, in which flow sets are tested using the single-criticality analysis. Our mixed-criticality analysis method is MixedAna. The performance metrics are the analyzable ratio (the percentage of flow sets which are tested as schedulable by an analyzing method) and the pessimism ratio (the proportion of analyzed delay to the delay observed in StealRM). Figure 4.9 shows the comparison of analyzable ratios. For each point, 500 test cases are analyzed. Our method MixedAna outperforms SingleAna. The analyzable ratios decrease with the increase of these parameters. The reasons are similar to those in Fig. 4.7. The increases of U and M lead to more packets, and the increases of |N| and ρ lead to more flows. These will cause more interference. Thus, the analysis introduces more pessimism, and the analyzable ratios decrease. Figure 4.10 shows the pessimism ratios of experiments in Fig. 4.9. The pessimism ratios of MixedAna are less than 2, while the pessimism ratios of SingleAna are all larger than 2. This is because the interference that does not exist between H-crit and L-crit flows is eliminated in MixedAna.

Fig. 4.9
4 multi-line graphs A, B, C, and D of analyzable ratio versus U plots Mixed Ana and Single Ana. All the graphs follow a decreasing trend.

Schedulability comparison among analyzing algorithms. (a) |N| = 20, M = 6, ρ = 0.1. (b) |N| = 20, M = 6, ρ = 0.3. (c) |N| = 20, M = 9, ρ = 0.1. (d) |N| = 60, M = 6, ρ = 0.1

Fig. 4.10
4 multi-line graphs A, B, C, and D of pessimism ratio versus U plots Mixed Ana and Single Ana. Single Ana follows an increasing trend, whereas Mixed Ana follows a constant trend in all the graphs.

Delay comparison with StealRM being used as the baseline. (a) |N| = 20, M = 6, ρ = 0.1. (b) |N| = 20, M = 6, ρ = 0.3. (c) |N| = 20, M = 9, ρ = 0.1. (d) |N| = 60, M = 6, ρ = 0.1

4.7 Summary

Mixed-criticality data flows coexist in advanced industrial applications. They share the network resource, but their requirements for the real time performance and reliability are different. In this chapter, we propose a scheduling algorithm to guarantee their different requirements, and then analyze the schedulability of this scheduling algorithm. Simulation results show that our scheduling algorithm and analysis have more performance than existing ones.