## 5 Analytical Modeling
### Modeling the Sequence of Cycles  
We now model the transport scheme by accounting for the sequence of cycles in order to get the expected completion time (round-trip delay) of the file and the energy consumption. Let \(q_{n}\) (\(q_{n}\geq 1\)) denote the number of coded packages still absent for the destination node to decode source file at the beginning of \(n\)th cycle. It is obvious that \(\{q_{n},q_{n}\geq 1\}\) can be seen as a Markov chain with state space \(\{0,1,2,\ldots,K\}\). The chain begins with \(q_{1}=K\), and gets absorbed in state 0. Let \(P_{rj}(t)\) represent the transfer probability of \(q_{r}\) from state \(r\) to state \(j\). That is, the lowest-index ACK received by the source node at \(t\) is \(j\), given that the source starts up with cycle \(r\). \(P_{rj}(t)\) can be calculated according to the Formula (19):  
\[P_{rj}(t)=P_{Yj}(t)\cdot\prod_{v=0}^{j-1}(1-P_{Yv}(t)),\text{ for }r\
eq j, \tag{19}\]  
and  
\[P_{rr}(t)=1-\sum_{j=0}^{r-1}P_{rj}(t), \tag{20}\]  
where \(P_{Y_{j}}(t)\) is the probability that the source node has received ACK \(j\) at \(t\).  
* Expected round-trip delay of file  
Let \(ED_{r}\) (\(r=1,2,\ldots,K\)) represent the expected time to reach the final state 0 from the beginning of cycle \(r\). Thus, \(ED_{K}\) represents the expected round-trip delay for the source to receive ACK 0. \(ED_{r}\) can be calculated by the following formula:  
\[ED_{r}=P_{r0}(T_{r})\cdot E[T_{r\to 0}]+(1-P_{r0}(T_{r}))\cdot T_{r}+\sum_{j=1}^{r}P_{rj}(T_{r}) \cdot ED_{j} \tag{21}\]  
where \(T_{r}\) is the length of cycle \(r\), and \(T_{r}=T_{s\_r}+T_{w\_r}\). \(E[T_{r\to 0}]\) denotes the expected time to reach state 0 by the end of the current cycle \(r\), given that the source starts up with cycle \(r\). \(E[T_{r\to 0}]\) can be calculated by the following formula:  
\[E[T_{r\to 0}]=\int_{0}^{T_{r}}t\cdot f_{r\to 0}(t)dt=T_{r}\cdot F_{r\to 0}(T_{r})-\int_{0}^{T_{r}}F_{r\to 0}(t)dt \tag{22}\]  
where \(f_{r\to 0}(t)\) and \(F_{r\to 0}(T_{r})\) are the probability distribution function (PDF) and CDF of ACK 0 delay, under the condition that this delay is lower than \(T_{r}\). Thus, we have \(F_{r\to 0}(t)=\frac{P_{r0}(t)}{P_{r0}(T_{i})}\). Substituting \(E[T_{r\to 0}]\) into Formula (21), we can get the final expression of \(ED_{r}\):  
\[ED_{r}=\frac{T_{r}-\int_{0}^{T_{r}}P_{r0}(t)dt+\sum_{j=1}^{r-1}P_{rj}(T_{r}) \cdot ED_{j}}{1-P_{rr}(T_{r})},\quad(r=1,2,...K) \tag{23}\]  
* Expected energy consumption  
According to literature [42], the energy consumption of a network is mainly related to the total forwarding times of messages. For the sake of simplicity, we define it as the product of the unified cost of a transmission and the total number of packet transmissions. Let \(EC_{r}\) (\(r=1,2,\ldots,K\)) represent the expected energy consumption to reach the final state 0 starting from the beginning of cycle \(r\). Similar to the derivation of \(ED_{r}\), we can express the \(EC_{r}\):  
\[EC_{r}=C_{trans}\cdot\frac{P_{r0}(T_{r})\cdot\sum_{i=1}^{H}X_{i}(E[T_{r\to 0}])+(1-P_{r0}(T_{r}))\cdot\sum_{i=1}^{H}X_{i}(T_{r})+ \sum_{j=1}^{r-1}P_{rj}(T_{r})\cdot EC_{j}}{1-P_{rr}(T_{r})} \tag{24}\]  
where \(C_{trans}\) denotes the unified cost of a transmission, and \(X_{i}(t)\) is the number of type \(v_{i}\) nodes at time \(t\). From the above expressions, \(ED_{K}\) and \(EC_{K}\) are functions of parameters \(\{M_{r},T_{s,r},T_{w,r}\}\) (\(r\in(1,2,\ldots,K)\)). Thus, if the network knowledge \(\lambda\) and \(N\), as well as parameters \(\{M_{r},T_{s,r},T_{w,r}\}\), (\(r\in(1,2,\ldots,K)\)) is obtained, we can get the expected round-trip delay \(ED_{K}\) and the corresponding energy consumption \(EC_{K}\).