## 4 Sensor Packet Loss Compensation
### Adaptive Parameter Updating  
Under the assumption that a high proportion (\(\approx\)99.9%) of samples will be successfully delivered in a well-designed wireless network [3; 8; 9; 12], statistically there is a large amount of process information available which can be used to recursively update the process model parameters. In order to adaptively track parameter variations, the Recursive Least Squares (RLS) algorithm may be employed [27]. Firstly, the CARIMA model parameters at sample instant k may be written in vector form:  
\[\begin{split}\theta(k)=&\left(a_{1}(k),a_{2}(k), \ldots,a_{n}(k),\right.\\ b_{0}(k),b_{1}(k),&\ldots,b_{m}(k)\left.\right) \end{split} \tag{5}\]  
And the vector of independent variables \(x(k)\) which is constructed from the previous input/output process data can be written as:  
\[\begin{split} x(k)=&\left(-\Delta y(k-1),\ldots,- \Delta y(k-n),\right.\\ \left.\Delta u(k-d),\ldots,\Delta u(k-d-m)\right)\end{split} \tag{6}\]  
In both cases, the length of the vectors is equal to \(m+n\). Equation (3) may then be rewritten in a form suitable for on-line estimation as:  
\[\Delta\hat{y}(k)=\theta^{T}(k)\cdot x(k) \tag{7}\]  
When a packet is successfully delivered at sample index \(k\), the parameter vector can be updated based upon the prior error \(e_{\rho}(k)\) between the predicted and actual change in process values. Using the parameter vector from step \(k-1\) yields:  
\[e_{{}_{P}}(k)=\Delta y(k)-\left(\theta^{T}(k-1)\cdot x(k)\right) \tag{8}\]  
Defining the update rule for the inverse of an \((m+n)\)-by-\((m+n)\) symmetric \"information matrix\" \(P\) as follows:  
\[P(k)^{-1}=\lambda\cdot P(k-1)^{-1}+x(k)\cdot x(k)^{T} \tag{9}\]  
where \(\lambda\in\,(0,1]\) is a \"forgetting factor\" which is used to exponentially reduce the weight or importance of past data by a factor \(\lambda\) at each step. The choice of \(\lambda\) can impact upon the speed of adaptation and also the stability of the estimator; values close to unity lead to slower convergence with increased stability, while smaller values lead to faster tracking with reduced stability. The asymptotic memory length \(N\) (in samples) of the RLS estimator with non-unity forgetting factor \(\lambda\) is given by \(N=1/(1-\lambda)\). The memory length is effectively a time-constant indicating the rate at which information is lost, which provides some guidance on an appropriate choice for \(\lambda\)[28]. For most process control applications, in the absence of any knowledge on the rate of parameter fluctuations previous work suggests to use a memory length between \(\approx 1000\) to 10,000 samples, _i.e._, to use \(\lambda\in[0.995,\,0.9999]\)[27; 28]. If no parameter fluctuations are expected then information loss can be disabled by setting \(\lambda=1\). In some situations it may be prudent to employ a variable forgetting factor \(\lambda(k)\) to prevent co-variance wind-up when the input signal is expected to be stationary for long intervals (e.g., with the process in steady-state)--further details can be found in [27] and [28], and the references contained therein. After computing Equations (8) and (9) at sample \(k\), the parameter vector can then be updated using the main RLS computation which is as follows:  
\[\theta(k)=P(k)\cdot x(k)\cdot e_{p}(k) \tag{10}\]  
To remove the need for direct matrix inversion, the Sherman-Morrison formula may be used to directly update \(P\) with \(P(0)\) initialized to a suitable value, e.g., \(I\times 10^{-6}\). The implementation complexity of such a procedure is \(O((m+n)^{2})\) per iteration due to the need to provide the rank-1 correction to matrix \(P\) before application of (10) [27]. Although this is reasonably small, in order to keep the overheads of the scheme to a minimum, the model order should ideally be kept to a small value. In the next Section it is argued that under the previous assumptions of the paper, \((m+n)\leq 10\) holds for many of the systems of interest in this paper.