## 3 Problem Formulation
### Fundamental Concepts for Energy Consumption
#### 3.2.3 Energy Consumption Model for Image Transmission  
The analytical energy consumption model defined in Equations (6) and (11) represent reliable communications in sensor networks where every packet is acknowledged and retransmitted if necessary, considering a hop-by-hop approach implemented in MAC or transport layer. We can further extend this model to adapt to the transmission of images, where every image \(i\), \(i=1\),..., \(i=I\), sizing \(B_{i}\) bits is transmitted from a source node to the sink. It was stated before that the (maximum) size in bits of data packet is \(s\), but this size corresponds to the payload and all protocol headers. If the packet header regarding all employed protocols sizes \(k\) bits, \(k<s\), the maximum effective payload size for every transmitted packet is (\(s-k\)) bits. As \(B_{i}>>s\) in most cases, the original image \(i\) will be fragmented, and a fragmentation header with \(f\) bits containing information for the decoding at the receiver side will be added to every packet. Moreover, an image \(i\) may have an image header, with \(i_{o}\) bits, providing information as the width and height of the image and the number of bits used to represent a pixel. Thus, the number of packets to be transmitted is (\(B_{i}+i_{o}\))/(\(s-k-f\)), with packets carrying data information to their maximum payload excepting the last one, which may be carrying less data than its capacity. We define \(D_{pi}\) as the number of packets to be transmitted sizing \(s\) bits. The last packet has \(Ld_{pi}\) as the payload size, \(Ld_{pi}<(s-k-f)\). Defining the maximum packet payload as \(l\), \(l=(s-k-f)\), it is achieved the formulas for \(D_{pi}\) and \(Ld_{pi}\), as expressed in Equation (12).  
\[\begin{split} D_{pi}=&\left\lfloor\frac{\left(B_{i}+i_{o} \right)}{l}\right\rfloor\\ Ld_{pi}=&\left(\left(B_{i}+i_{o}\right)-l\left\lfloor \frac{\left(B_{i}+i_{o}\right)}{l}\right\rfloor\right)\end{split} \tag{12}\]  
Assuming \(Ptd_{ph}\) as the packet error rate in hop \(h\) when \(n=(Ld_{pi}+s-l)\) in Equation (4), where \((s-l)\) is the total packet headers and overheads, it is obtained the average number of transmissions and retransmissions of the last packet in hop \(h\), \(Rtd_{ph}\), when employing \(Ptd_{ph}\) in Equation (8). This is necessary since the packet error rate is a function of the sizes of the packets. The probability of ACK transmissions is also affected by the possible smaller size of the last packet after fragmentation. Applying the value of \(Ptd_{ph}\) to Equation (10), it is obtained the average number of ACK messages to acknowledge the transmission of the last packet in hop \(h\), \(Rad_{ph}\). The new formulations for \(T_{pih}\) and \(A_{pih}\) for the transmission of an image \(i\) are presented in Equation (13). We define \(Ptd_{ph}=0\), \(Rtd_{ph}=1\) and \(Rad_{ph}=1\) if \(Ld_{pi}=0\).  
\[\begin{split} T_{pih}=D_{pi}.S.Rt_{ph}+\left(Ld_{pi}+s-l\right)Rtd _{ph}\\ A_{pih}=a.\left(D_{pi}.Ra_{ph}+Rad_{ph}\right)\end{split} \tag{13}\]  
Using the definitions for \(T_{pih}\) and \(A_{pih}\) in Equation (13), the resulting equation in Equation (6) presents a comprehensive energy consumption model for transmission and reception of packets carrying parts of an image \(i\) in full reliable communications. The required energy for processing the original image was not accounted in this model, but a standard energy formulation for DWT processing will be considered in next section. Furthermore, the size \(B_{i}\) refers to a raw image \(i\), but compression could be used to reduce the total amount of information to be transmitted, at the cost of processing and energy resources of source nodes. Image compression is not considered in this work but, in the case that compression is employed, lossless compression should be used since it is typically less complex and resource-demanding than lossy compression [16, 29]. However, lossy algorithms could be exploited if resource-rich source nodes are deployed, achieving higher compression efficiency.