## 5 Dealing with Packet Loss on Actuators  
To meet the above requirement, we attempt to develop an application-level design methodology for WSANs in mobile control applications. The principles in our development are: 1) to modify only the application layer of the networks without exploiting any application-specific (lower layer) network protocols, 2) not to use any statistic information about the distribution of packet loss rate in any specific WSAN, and 3) not to use the knowledge about the models of the controlled physical systems and the controller design of the target control applications.  
We propose to use a simple yet efficient method on the actuator nodes to cope with packet loss occurring in WSANs. The basic idea is: whenever a sensor data packet is lost, the actuator will still produce a control command (usually called _control input_ in control terms) by means of prediction from previous control command values.  
For a control loop within a (possibly large-scale) system shown in Fig.1, suppose that the \(k\)-th sensor data is lost. In this case the actuator (to which the last data should be sent) will calculate an  
Figure 5: Packet loss rate vs. distance (-5 dBm).  
estimate of the control command using the PID (proportional-integral-derivative) algorithm, the most popular control algorithm in the control community, as follows:  
\[\hat{u}(k)=\tilde{K}_{p}u(k-1)+\tilde{K}_{l}\sum_{i=k-m}^{k-1}\frac{u(i)}{m}+ \tilde{K}_{D}(u(k-1)-u(k-2)) \tag{1}\]  
where \(\hat{u}(k)\) is the estimate of the \(k\)-th control command \(u(k),\ \tilde{K}_{p}\,,\ \tilde{K}_{l}\,,\ \tilde{K}_{D}\,\)and \(m\) are user-specified parameters. Using (1), the actuator predicts \(u(k)\) based on the previous \(m\) consecutive control commands (which are also possibly predicted values) in the case of packet loss and performs the actions corresponding to the value of \(\hat{u}(k)\). Given that the accuracy of the prediction of control commands is sufficiently high, proper actions will be performed on the controlled physical system in every sampling period, regardless of the loss of the sensor data. In this way, the effect of packet loss on the performance of the control applications can be substantially reduced. In other words, the reliability of the WSAN is improved, from the application point of view.  
The PID algorithm is here used to predict the unavailable control commands that result from sensor packet loss. In the control community, in contrast, it is typically used in control system design, as will be shown later in Section 6. [PERSON] _et al._[37] have used a similar method called nqPID to predict CPU workload in dynamic voltage scaling systems. It proved quite effective and insensitive to parameter changes.  
The work flow of the actuator can be illustrated as follows:  
**Input**: Sensor data  
**Output**: Control command  
_Begin_  
**If** _the sensor data is lost_ **then**  
Compute \(\hat{u}(k)\) using (1)  
**Else**  
Compute \(u(k)\) using pre-designed control algorithm(s)  
**End if**  
Store \(u(k)\) or \(\hat{u}(k)\) in memory  
Discard \(u(k\)-\(m)\) in the memory  
Perform actions corresponding to \(u(k)\) or \(\hat{u}(k)\)  
_End_  
It can be seen that this design method is quite simple. The major overhead is a small fraction of memory to temporarily store the previous \(m\) control commands. Despite this, it does not depend on any knowledge about the underlying platform, environment, link quality characteristics, models of the controlled systems, or controller design. Furthermore, only a very limited amount of computations have been introduced, which fulfills well the general requirements of WSANs concerning the constraints on computational capacity and energy expenditure. In addition, it is worth mentioning that although zero delay is assumed in this paper, the proposed design method can be easily combined with the real-time queuing protocol developed in [19-21] to deal with simultaneously time-varying delay and packet loss.