## 4 Protocol Framework
### Methods
#### 4.4.2 Encountering and Detection
\begin{array}{rl}L_{n}&=\ln\frac{\prod_{i=1}^{n}\Pr(S_{L}^{i}\big{|}H_{1})}{ \prod_{i=1}^{n}\Pr(S_{L}^{i}\big{|}H_{0})}\\ &=\sum\limits_{i=1}^{n}\ln\frac{\Pr(S_{L}\big{|}H_{1})}{\Pr(S_{L}\big{|}H_{0} )}\end{array}  \tag{23}\]  
Let \(\omega_{a}^{L}\) represent the cumulative total of the number of times a specific event that \(S_{L}^{i}=1\) occurs in the \(n_{a}^{L}\) samples of the tracked node \(L\) whose witness node is node \(a\), then Equation (23) can be reformulated to obtain:  
\[L_{n}=\omega_{a}^{L}\times\ln\frac{\alpha_{1}}{\alpha_{0}}+(n_{a}^{L}-\omega_ {a}^{L})\times\ln\frac{1-\alpha_{1}}{1-\alpha_{0}} \tag{24}\]  
where \(\alpha_{0}=\Pr(S_{i}|H_{0})\) and \(\alpha_{1}=\Pr(S_{i}|H_{1})\), the fundamental principle of the parameter setting of \(\alpha_{0}\) and \(\alpha_{1}\) is described below: \(\alpha_{0}\) should be set according to the possibility of the event that a normal node is misjudged as cloned node due to time synchronization and localization errors. Another dimension to consider is the fact that \(\alpha_{1}\) should be configured according to the possibility of the event that the measured speed of a cloned node is over the predefined maximum value \(v_{\max}\). On the basis of above analysis, the former should be less than the later. Sequential probability ratio test takes advantage of the log-probability ratio \(L_{n}\) to determine whether to accept the hypothesis \(H_{0}\) or the hypothesis \(H_{1}\) or not. The decision process is given as follows:  
\(L_{n}\leq\ln\frac{\gamma}{1-\eta}\); The hypothesis \(H_{0}\) is correct and the detection is over;\(L_{n}\geq\ln\frac{1-\gamma}{\eta}\); The hypothesis \(H_{1}\) is correct and the detection is over;  
\(\ln\frac{\gamma}{1-\eta}<Ln<\ln\frac{1-\gamma}{\eta}\); Continue the detection process with sample,  
where \(\gamma\) is the maximum false negative rate, and \(\eta\) is the maximum false positive the next rate. Then we substitute Equation (24) into the decision process to reformulate the process:  
\(\omega_{a}^{L}\leq\Psi_{0}(n_{a}^{L})\); The hypothesis \(H_{0}\) is correct and the detection is over;  
\(\omega_{a}^{L}\geq\Psi 1(n_{a}^{L})\); The hypothesis \(H_{1}\) is correct and the detection is over;  
\(\Psi_{0}(n_{a}^{L})<\omega_{a}^{L}<\Psi 1(n_{a}^{L})\); Continue the detection process with the next sample,  
where \(\Psi_{0}(n_{a}^{L})=\frac{\ln\frac{\gamma}{1-\eta}+n_{a}^{L}\times\ln\frac{1- \gamma_{0}}{1-\gamma_{1}}}{\ln\frac{\gamma_{0}}{\gamma_{0}}-\ln\frac{1- \gamma_{1}}{\gamma_{0}}}\), \(\Psi_{1}(n_{a}^{L})=\frac{\ln\frac{1-\gamma}{\eta}+n_{a}^{L}\times\ln\frac{1- \gamma_{0}}{1-\gamma_{1}}}{\ln\frac{\gamma_{0}}{\gamma_{0}}-\ln\frac{1- \gamma_{1}}{\gamma_{0}}}\) At the same time, the detection information \(I_{a}^{L}=(n_{a}^{L},\omega_{a}^{L})\), which belongs to the tracked node \(L\) whose tracer is node \(a\), is stored in a queue associated with the node \(L\). Once a mobile node is detected as a replicated node, then the witness node makes use of broadcast security protocol [39] to notify all nodes in the wireless sensor networks to ignore the malicious node. The protocol is over, otherwise, the protocol proceeds to the third phase, the forwarding and detection stage.