# A Mechanism for Reliable Mobility Management for Internet of Things Using CoAP
## Appendix A  
Derivation of Equation (5): \(D=\sum_{k=0}^{\mathrm{m}-1}(1-A_{f})A_{f}^{k}\Big{\{}T_{r}+\left(2^{k}-1\right) T_{w}\Big{\}}+A_{f}^{\mathrm{m}}(2^{\mathrm{m}}-1)T_{w}\), where \(D\) is the average retransmission delay \(D\) for transmitting a CoAP signaling message, and \(k\) is the retransmission count, and the timeout \(T_{w}\) is the amount of time that the mCSN waits for an acknowledgement packet from a remote device. The roundtrip time \(T_{r}\) is the time from the start of the transmission until an ACK message is received. Proof: First, we introduce a model for this delay that adopts the CoAP retransmission mechanism, and analyze handover delays based on this model. To estimate the handover delay, we measure the average retransmission delay with the exponential back-off for a confirmable message. Table 11 shows the model for the average retransmission delay of a CoAP message. In Table 11, a white box indicates that the CoAP packet was successfully transmitted to another CoAP node, and a checked box indicates that the CoAP packet was not transmitted to the CoAP node due to the lossy network environment. The model's parameters and notations are as follows:  
\(T_{w}\): The timeout, \(T_{w}\), is the time that the CoAP node waits for an acknowledgement packet from a remote device before resending the last local confirmable message. The initial timeout is set to a random duration (often not an integral number of seconds) between the ACK_TIMEOUT and (ACK_TIMEOUT * ACK_RANDOM_FACTOR). In the CoAP standard [15], the ACK_TIMEOUT and ACK_RANDOM_FACTOR are transmission parameters, with default values of 2 and 1.5 s, respectively. In implementing CoAP, the initial timeout is set to a random value between 2000 and 3000 ms. When \(T_{w}\) is triggered and the retransmission counter is less than the maximum number of retransmissions, the message is retransmitted. The retransmission counter is then incremented, and the next timeout is doubled. \(T_{r}\): The roundtrip time, \(T_{r}\), is the time from the start of the sending node's transmission to the receipt of the acknowledgement message by the same CoAP node. \(T_{r}\) is the sum of the average back-off time period, the packet-transmission time, the transceiver's transmitting-to-receiving turnaround time, the ACK transmission time, and the Inter Frame Spacing (IFS) time. Details surrounding thetransmission delay for IEEE 802.15.4 can be found in reference [19]. From this reference [19], we set T\({}_{s}\) to 4.4 milliseconds in a 60-byte payload to evaluate the performance. _r_: The retransmission counter, \(r\), indicates the number of retransmissions, which increases every time the CoAP node does not receive an acknowledgement message within \(T_{w}\). In the CoAP standard, the maximum value, \(m\), of the retransmission counter is set at 4. The maximum number of retransmissions is therefore 3, because the initial retransmission count is zero. _A\({}_{f}\):_ A\({}_{f}\) is the probability that the CoAP signaling message with \(f\) fragments will not be successfully transmitted. We discussed this probability in the previous section. Table 11 shows the model for the average delay in transmitting a CoAP message, including the CoAP retransmission mechanism. The CoAP node sends a confirmable message after setting the timeout \(T_{w}\) for sending confirmable messages. Given that the local CoAP node receives the acknowledgement message, the transmission delay is \(T_{r}\). At that time, the probability of transmission failure for each CoMP signaling message is \(A_{f}\). However, if the local CoAP node does not receive the acknowledgement message within \(T_{w}\), the CoAP node attempts its first retransmission of the message after the timeout is set to \(2T_{w}\) and the retransmission counter is increased. At that time, the probability of the occurrence of a single retransmission is \(\left(1-A_{f}\right)A_{f}\).