## 4 Flexible Time-Triggered Sampling
When the network is underutilized, on the other hand, the network utilization can be increased through shortening the sampling period. According to sampled data control theory, smaller sampling periods normally deliver better QoC. In this context, the QoC can therefore be improved with higher resource efficiency, given that the deadline miss ratio is limited within a low level. The observation is that, by means of sampling period adjustment with respect to network condition, dynamic and unpredictable workload variations in the WCS can be dealt with effectively. This explains why sampling period is chosen as the manipulated variable. Figure 3 shows the flexible time-triggered sampling scheme proposed in this paper. Just as the name implies, this scheme is based on time-triggered sampling. Basically, the sensor samples the system output at uniform time intervals. The major difference between our scheme and conventional time-triggered scheme is that the sampling period will be changed regularly with our scheme, whereas the conventional scheme normally uses fixed sampling periods. This results in significantly enhanced flexibility of the system, and hence largely improved QoC in dynamic environments, as will be shown in Section 5. As shown in Figure 3, the flexible time-triggered sampling scheme operates as follows. Within every invocation interval, all nodes act almost the same as under time-triggered sampling, except for an additional module in the actuator. When the actuator receives a control command, it will not only perform actions on the physical process according to the control command but also judge whether or not this control command misses its deadline. For this purpose, the deadline of the control command will be issued by the smart sensor (when the sampled data is collected) and encapsulated in both data packets for sampled data and control command. If the deadline is not missed, the actuator will then report this to the sensor by directly sending it an arbitrary data. This information will be used by the  
Figure 3: Flexible time-triggered sampling. smart sensor to compute the deadline miss ratio at the beginning of each invocation interval, i.e. each time the system starts to adjust the sampling period. The sensor will compute a new sampling period based on the observed deadline miss ratio every \(T_{Sp_{4}}\) time units. The algorithm used will be given in Subsection 4.1. After the new sampling period is produced, the sensor will update the relevant internal parameter(s) accordingly. Since sampling period variations will degrade QoC if fixed controller parameters are used in the controller, the controller parameters should be updated with respect to current sampling period. In practice, this can be achieved in two ways. The first way is that the sensor transmits the new sampling period (via the wireless network) to the controller using a separate data packet once a new sampling period is calculated. An acknowledgement will be sent by the controller if it successfully receives the sampling period data packet. The sensor will re-transmit this data packet after waiting for some specific time until an acknowledgement from the controller is received. Upon receiving a new sampling period, the controller will update the relevant controller parameters accordingly. In the second way, the current sampling period will always be encapsulated in the data packet for sampled data, which is sent from the sensor to the controller at the beginning of every period. The controller treats sampling period as an additional input variable and computes the control command with respect to both the sampled value of system output and the current sampling period. Using either of these ways, the variations in sampling period can be compensated for, at the expense of a slight increase in both computation and communication overheads. In this paper, the second method is adopted.