# 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.1 Determining the Parity Length for a Node Itself  
In EA-RS, determining the parity length consists of predicting the amounts of energy collected and consumed. In short, it chooses a parity length that satisfies the following two requirements:  
* (1) The parity length that allows the amount of residual energy after the end of the next period not to exceed the maximum capacity of the battery: these parity lengths can minimize the amount of energy dissipated owing to the limited battery capacity. By using these parity lengths, the node consumes more energy than must be wasted in order to prevent the remaining energy from exceeding the battery capacity. * (2) The smallest parity length among those of (1): by using this parity length, the node can use the minimal required energy for data reliability, except for energy that must be wasted. That is, it allows the node to store as much energy as possible while minimizing the blackout time. As described above, this parity length is the optimal value in order to minimize the blackout time while also minimizing the energy that is discarded owing to the constrained battery capacity, and EA-RS should determine this value. To determine the parity length, the predicted amount of residual energy after the next period should be modeled. If the current time is \(t\) and the transmission period is denoted by \(p_{\text{tx}}\), then the estimated amount of energy remaining in node \(i\) after this period, \(E^{i}_{\text{residual}}(t+p_{\text{tx}})\), can be modeled as follows [18]:  
\[E^{i}_{\text{residual}}(t+p_{\text{tx}})=E^{i}_{\text{residual}}(t)-E^{i}_{ \text{consume}}+\mathbb{E}^{i}_{\text{harvest}} \tag{9}\]  
where \(E^{i}_{\text{residual}}(t)\) denotes the amount of energy remaining in the node at the current time \(t\), which can be obtained through an actual measurement, and \(E^{i}_{\text{consume}}\) and \(\mathbb{E}^{i}_{\text{harvest}}\) are the predicted amounts of consumed and collected energy, respectively, during the period \(p_{\text{tx}}\) from time \(t\) to time \(t+p_{\text{tx}}\), which can be obtained through Equations (1) and (4). In particular, as can be seen from Equations (7) and (8), the energy consumption \(E^{i}_{\text{consume}}\) can be controlled by varying the parity length. Our goal is to find the optimal parity length to store the maximum amount of energy in order to reduce blackout time while minimizing the energy dissipation owing to battery capacity limitations. To achieve this, we gradually increase the parity length \(D^{i}_{\text{parity}}\) starting from the minimum value and repeatedly verify that it satisfies the following Equation (10). That is, the initial parity length value (minimum parity length) should first be tested so that the expected remaining energy \(E^{i}_{\text{residual}}(t+p_{\text{tx}})\) of node \(i\) is calculated according to Equation (9). Then, this is compared with the maximum capacity \(B^{i}_{\text{full}}\) of the node \(i\). If the following Equation (10) is satisfied, then the parity length \(D^{i}_{\text{parity}}\) is increased by \(\gamma\). \[E^{i}_{\text{residual}}(t+p_{\text{tx}})>B^{i}_{\text{full}} \tag{10}\]  
where \(\gamma\) is the factor by which the parity length is increased, which is a natural number. Increasing \(D^{i}_{\text{parity}}\) increases the data recovery rate, but also increases the node's energy consumption, to reduce the amount of remaining energy. This procedure is repeated until Equation (10) cannot be satisfied. As a result, EA-RS can obtain \(D^{i}_{\text{parity}}\), such that the maximum energy can be stored while minimizing the wasted energy. The minimum parity length will be selected for periods with no energy collection (e.g., nighttime). ENO can never be satisfied for such periods, regardless of how short the parity length is, as the amount of collected energy is less than the energy required for the node to perform only basic operations (excluding FEC operations).