# Energy-Aware Control of Error Correction Rate for Solar-Powered Wireless Sensor Networks
## 3 Energy-Aware Reed-Solomon Scheme
### Determining the Parity Length for the Next Period
#### 3.3.2. Finalizing the Parity Length Considering a Target Node's Status  
When the node sends data, the parity length of the receiving node must be considered. Note that the amount of energy used by the receiving node to decode the data depends on the parity length, as shown in Table 2, and the difference is not negligible. Assume that the sending node transfers the data encoded with its own parity length, which is larger than that of the receiving node. Then, the receiving node would consume more energy than it anticipates when performing the decoding and could be blacked out, because the receiving node predicts the amount of energy consumed in decoding with assuming that the incoming data would be encoded with its own parity length instead of the sender's one. In this case, therefore, the parity length of the sending node and the receiving node should be compared, and if that of the receiving node is smaller, the parity length of the sending node must be reduced to that of the receiving node.  
For this reason, in order to determine the final parity length, we must consider not only the node's own parity length \(D^{i}_{\text{parity}}\) but also the parity length \(D^{j}_{\text{parity}}\) of the receiving node \(j\). To this end, the transmitting node must know the parity length of the receiving node \(D^{j}_{\text{parity}}\), which is possible by receiving this from the neighbor node \(j\) at the start of every period. Such an operation can be implemented by including the information on the parity length in the routing control packet. This increases the size of the routing control packet. However, because the parity length is a small natural number, the overhead is negligible. At node \(i\), EA-RS compares the parity lengths of itself and the receiving node \(j\) in order to determine the final parity length of node \(i\) as follows:  
\[D^{i}_{\text{parity}}<D^{j}_{\text{parity}} \tag{11}\]  
If Equation (11) is satisfied, then the data are encoded and transferred with the parity length of \(D^{i}_{\text{parity}}\), because the receiving node \(j\) has sufficient energy to handle it, which means that the blackout time of node \(j\) will not increase. In the opposite case (if Equation (11) is not satisfied), the node \(i\) encodes and transmits the data with the parity length \(D^{j}_{\text{parity}}\), as the blackout time of the receiving node \(j\) increases when the transmitting node \(i\) encodes and transfers data with its current parity bit size \(D^{i}_{\text{parity}}\).  
In summary, because the energy consumption of both the transmitting and receiving nodes becomes larger as the parity length increases, the transmitting node selects a lower value between the parity lengths of the transmitting and receiving nodes. Then, the data are encoded and transferred with this lower parity length so that the blackout times of both nodes are unaffected. In this manner, EA-RS dynamically adjusts the parity length to the best energy consumption level for improving data reliability. That is, EA-RS uses as much energy as possible in order to increase the data recovery rate, but the energy used for this operation does not cause additional blackout time, because it only uses energy that would be discarded owing to the limited battery capacity. The pseudo-code of the proposed EA-RS algorithm is described in Algorithm 1.