# Enhancing the Reliability of Cellular Internet of Things through Agreement
## 4 An Example of CIOTAP Executed the Proposed Protocol
**(e)** The agreement vector of \(e_{12}\) by _Data Resolution Stage_ of _MEC-tier_. Subsequently, in the _Data Resolution Stage_, the function _Decision_ ( ) is applied to the root of the _dc-tree_ corresponding to each MEC PU to obtain the decision value. Then, an agreement vector can be obtained by each MEC PU in the MEC cloud \(E_{1}\). Among them, each element in the agreement vector represents the decision value of each MEC PU in the MEC cloud \(E_{1}\). The agreement value obtained by the MEC PU in the MEC cloud \(E_{1}\) can be calculated with majority value through each element in the agreement vector. After the majority value is calculated, the agreement value is obtained by MEC PUs \(e_{12}\) and \(e_{16}\), respectively, as shown in Figure 9e,f. Finally, the agreement value obtained by each MEC PU in the MEC cloud in the _MEC-tier_ will be transferred to the _Cloud-tier_. In CIoTAP, the agreement value transmitted from the MEC PU in the MEC cloud at the _MEC-tier_ is received by the Cloud PU in the _Cloud-tier_. All agreement values received from MEC PUs in the MEC cloud are calculated as majority value. This calculated majority value is used as the initial value of the Cloud PU when the function _Agree_ ( ) is executed. The initial value of each Cloud PU in the _Cloud-tier_ is shown in Figure 10a. In this example, two times of data exchanges (\(\sigma=\lfloor(n_{C}-1)/3\rfloor+1\)\(+\)\(1=\lfloor(6-1)/3\rfloor+1=2\), where \(n_{C}\) is the number of Cloud PUs in _Cloud-tier_) are required when the  
Figure 10: An example of the Cloud PUs in the _Cloud-tier_ performing CIoTAP. (**a**) The initial value of each Cloud PU in _Cloud-tier_. (**b**) The _dc-tree_ of each Cloud PU in _Cloud-tier_ at the first time of _Data Collection Stage_. (**c**) The final dc-tree of \(c_{2}\) by _Data Collection Stage_. (**d**) The final dc-tree of \(c_{6}\) by _Data Collection Stage_. (**e**) The _Decision_ (_i_) of \(c_{2}\) in _Data Resolution_ Stage of _Cloud-tier_. (**f**) The _Decision_ (_i_) of \(c_{4}\) in _Data Resolution_ Stage of _Cloud-tier_. function _Agree_ ( ) is executed. In this example, assume that the Cloud PU \(c_{4}\) is a faulty PU, and there are six PUs in the _Cloud-tier_. At the first round of the _Data Collection Stage_, each Cloud PU in the _Cloud-tier_ transmits its initial value to all Cloud PUs in the _Cloud-tier_, and stores \(n_{C}\) (=6) data received from other Cloud PUs in the root of the corresponding _dc-tree_. The _dc-tree_ of each Cloud PU in _Cloud-tier_ at the first time of _Data Collection Stage_ is shown in Figure 10b. In the second time of _Data Collection Stage_, each Cloud PU sends the data in the root of the corresponding _dc-tree_ established in the first time of _Data Collection Stage_ to other Cloud PUs in the _Cloud-tier_, and stores the data that Cloud PU received in the level 2 of the \(n_{C}\) (=6) corresponding _dc-tree_. The progress of Cloud PUs \(c_{2}\) and \(c_{6}\) in the _Data Collection Stage_ are shown in Figure 10c,d, respectively. Subsequently, the function _Decision_ ( ) is applied to the root in the _dc-tree_ of each Cloud PU to obtain the decision value in the _Data Resolution Stage_. Each Cloud PU in the _Cloud-tier_ can obtain an agreement vector, and each element in the agreement vector is obtained by the function _Decision_ ( ). Each element is used in the agreement vector to represent the request of a specific application. The agreement vector of Cloud PUs \(c_{2}\) and \(c_{6}\) are shown in Figure 10e,f respectively. In the end, the agreement is reached in MECIoT. Finally, the services of the rock flow disaster monitoring system constructed by MECIoT can be supported by each Cloud PU in the _Cloud-tier_.