## 4 Application-Aware (AA) Scheduling Approach
The data delivery rate and delay metrics are calculated using Equations (1) and (2). \[\text{Delivery rate}(\%)=\text{100}\quad\frac{\text{DRid}}{\text{DSid}} \tag{1}\]  
\[\text{Delay(s)}=\frac{\text{S}\left(\text{RXt}\quad\text{TXt}\right)}{\text{ DSid}} \tag{2}\]  
Since the considered applications send data messages at different DTR values, the node does not send its statistical message about an application if the number of transmitted messages for this application is zero. To explain this, suppose that the DTR value of Application 2 is 10 min. This means that the rst data message for this application is transmitted after 10 min from the start of the run-time. During these 10 min, the nodes do not send statistical messages for Application 2 to the controller. The calculated metrics are sent to the application manager module to verify if the application's QoS requirements are satis ed. If so, Sch 0 continues to be the adopted scheduling. Otherwise, the TSCH scheduler module assigns a new scheduling and sends it to the controller, which in turn, disseminates it to the network nodes. Figure 3 shows the sequence of all the system operations. Figure 2: Sch 0 scheduling. Concerning the new scheduling calculation, more (or fewer) resources are assigned to ensure the application's QoS requirements. The proposed approach adds timeslots to the end of the slotframe depending on the calculated metrics values, as follows:  
* The calculated metric is (0-20)% worse than the application's requirement; a single timeslot is added to the end of the slotframe. * The calculated metric is (20-40)% worse than the application's requirement; two timeslots are added to the end of the slotframe. * The calculated metric is (40-60)% worse than the application's requirement; three timeslots are added to the end of the slotframe. To generalize the rule of adding more timeslots, we could say that if the calculated metric is from N% to (N + 20)% worse than the application's requirement, X timeslots are added to the end of the slotframe. This leads to saying that if the calculated metric is from (N + 20)% to (N + 40)% worse than the application's requirement, (X + 1) timeslots are added to the end of the slotframe. Similarly, when the calculated metric is better than the application's requirement, the proposed approach removes timeslots from the end of the slotframe as follows:  
* The calculated metric is (0-20)% better than the application's requirement; no timeslots are removed. * The calculated metric is (20-40)% better than the application's requirement; a single timeslot is removed from the end of the slotframe. * The calculated metric is (40-60)% better than the application's requirement; two timeslots are removed from the end of the slotframe. As a general rule, for N greater than or equal to 20, if the calculated metric is from N% to (N + 20)% better than the application's requirement, X timeslots are removed from the end of the slotframe. This leads to saying that if the calculated metric is from (N + 20)% to (N + 40)% better than the application's requirement, (X + 1) timeslots are removed from the end of the slotframe. Figure 4 shows the scheduling calculation procedure considering that MV is the metric value, AR is the application's requirement value, and TS represents the timeslot. Assigning multiple timeslots per application at the same time (if needed) could help to reduce the time required to ensure the application's requirements. Removing multiple timeslots (if needed), on the other hand, could help to save energy and increase the network lifetime. Figure 3: Sequence of the system operations. If the two requirements of an application are not satisfied, the number of added timeslots will depend on the highest number of required timeslots for each requirement. To explain this, suppose that during a metric calculation cycle, the delivery rate of Application 1 was 10% lower than the requirement, and the delay was 30% higher than the requirement. The number of added timeslots for Application 1 would thus be 2 timeslots.