## 4 Flexible Time-Triggered Sampling  
By definition, the bandwidth demand of a control loop is closely related to the size of the data packets and the sampling period. With given data packet sizes, the requested network utilization (i.e. workload) of control loops directly depends on the sampling periods of the sensors. This implies that it is possible to regulate the bandwidth demand of a control loop through adjusting the relevant sampling period. From this insight, we propose to adapt the sampling periods of sensors to workload variations at runtime. The basic idea of our scheme is to maintain the deadline miss ratio in every control loop at a desired level through periodically adjusting the sampling period. Since the sampling period adaptation algorithm will be implemented in every sensor separately, i.e., control loops are independent of each other, we will describe our scheme in this section by considering only one control loop, say loop \(i\), and omit this subscript for all variables wherever possible. Despite this, the sampling periods of all sensors will be changed simultaneously at runtime, with the same time interval. To avoid confusion, we call hereafter the periods of control loops (or sensors) _sampling periods_ (denoted \(h\)), while the time interval for executing period adaptation algorithms _invocation interval_ (denoted \(T_{\mathit{SPA}}\)). In this context, the sampling period of each sensor will be re-assigned every \(T_{\mathit{SPA}}\) time units with respect to current deadline miss ratio in the corresponding control loop. A deadline miss occurs when the actuator does not receive the control command by the deadline, which is by default equal to the sampling period. In WCSs, there are generally two types of deadline miss [3]. The first type is that the sampled data or the control command is truly lost in the transmission process. As a consequence, the control command will never arrive at the actuator. In contrast, in the second type of deadline miss, the control command is actually received by the actuator, but at a time point that exceeds the deadline. In this paper, feedback control technology is used to determine the new sampling period. In control terms, the _controlled variable_ is deadline miss ratio, and the _manipulated variable_ is sampling period. The deadline miss ratio is defined as the number of deadline misses to the number of periods that the control loop has experienced within a certain invocation interval. Some reasons for the choice of deadline miss ratio as the controlled variable are explained as follows. As one of the most common metrics for network quality of service (QoS), particularly from a real-time viewpoint, deadline miss ratio is an important factor that also affects QoC. Satisfactory QoC can be achieved as long as the deadline miss ratio is controlled at a sufficiently low level. Further, using deadline miss ratio as the controlled variable can address simultaneously the problems of time-varying delay and packet loss. According to the definition of deadline miss, both delays larger than the period and packet losses naturally incur deadline misses. When the deadline miss ratio keeps at a low level, the delays within most sampling periods will be no more than one period and the number of packets being lost is certainly limited. As a consequence, the impact of delay and packet loss on QoC is alleviated. The sampling period affects the deadline miss ratio in the following way. Shortening sampling period leads to increase in requested network utilization, which naturally causes the network workload to increase, and vice versa. With heavier network traffic load, the probability of collisions between different nodes becomes bigger. This could potentially increase both delay and packet loss, and hence the deadline miss ratio. Therefore, large deadline miss ratio can generally be reduced through enlarging the sampling period, particularly when the system is in overload conditions.