# Reliability Improved Cooperative Communication over Wireless Sensor Networks
## 4 Main Design of RICC
### Preliminary Knowledge
#### 4.2.1 Data Transmission Model  
According to NCCC model, the process of data collection is mainly composed of the following three stages: _Source Cluster routing stage_, _Transitional Cluster routing stage_ and _Destination Cluster routing stage_, as shown in Figure 1.  
(1) _Source Cluster routing stage._ First, the source node senses origin data \(\mathbf{D}\) and distributes them to the neighboring nodes in the same source cluster through broadcasting. After the functioning nodes receive \(\mathbf{D}\), they split it into \(M\) blocks:  
\[\mathbf{D}=(D_{1},\;D_{2},\;\ldots,\;D_{M})^{T} \tag{5}\]  
and generate a coding vector of size \(1\;\times\;M\) (denoted as \(\mathbf{v}\)) over finite field _GF(q)_ randomly. Then, the encode method for data packet is:  
\[\mathbf{C}=\mathbf{v}\times(D_{1},\;D_{2},\;\ldots,\;D_{M})^{T} \tag{6}\]  
(2) _Transitional Cluster routing stage._ When source node in the source cluster transmit data packet to the next cluster, which is called the transitional cluster. Then the data packet is transmitted  
Figure 3: Energy consumption of Network Coding-based Cooperative Communications (NCCC).  
by the transitional cluster using the same way until this packet is transmitted to the destination cluster [31], which contains the sink node. \[\mathbf{D_{r}}=(D_{r_{1}},\ D_{r_{2}},\ \ldots,\ D_{r_{n}})\] (7) Assume \(n\) data packets are received by a node in a certain transitional cluster. \(\mathbf{v_{r_{i}}}\) and \(\mathbf{C_{r_{i}}}\) are the coding vector and coded data, respectively. The \(n\) coding coefficients \((v_{1},\ v_{2},\ \ldots,\ v_{n})\) are produced by \(GF(q)\), the encoding method of data packet is as follow: \[\mathbf{v_{new}}=\sum_{i=1}^{n}v_{i}\times\mathbf{v_{r_{i}}}\] (8) \[\mathbf{C_{new}}=\sum_{i=1}^{n}v_{i}\times\mathbf{C_{r_{i}}}\] (9) where \(\mathbf{v_{new}}\) and \(\mathbf{C_{new}}\) are the coding vector and coded data of the new coded packet, respectively [31].
3. _Destination Cluster routing stage_. All data packets are transmitted to the destination cluster, then some nodes will transmit data packet to destination cluster. Those redundancy data will be removed, and the other packets are decoded to retrieve the original packets. In the packet transmission stage, \(N\) coded packets are transmitted from one cluster to another. Suppose there are \(\tau\) functioning nodes in a cluster. If \(\tau=N\), \(N\) packets will be equally delivered. If \(\tau<N\), then \(T_{d}=k\), for \(k=1,\ 2,\ \ldots,\ \tau\), the \(k\)-th node will transmit the corresponding \(k\)-th coded packet, and after the \(\tau\) coded packets have been transmitted by the \(\tau\) functioning nodes, the system will perform the operation \(T_{d}\%\tau\) to make the 1-th node send the \((\tau+1)\)-th packet, and the 2-th node send the \((\tau+2)\)-th packet, and until other (\(N\)-\(\tau\)) packets are transmitted to the next hop. In the first two stages, some status messages containing the IDs of nodes are generated. The functioning nodes in both source clusters and transitional clusters declare their status at their broadcast slot, while in other time slots, they receive the status messages of other functioning nodes in the same cluster. All the status messages are stored in a _TransQueue_ queue. After this process, all the functioning nodes' IDs are restored in the _TransQueue_ queue [31].