## 4 The Proposed Adaptive Channel Coding Technique
### The Outer Loop Link Adaptation Approach
Thus, the EEACC approach introduces a compensation factor \(\Delta C(t)\) which can be modelled as  
\[\Delta C(t)=\begin{cases}min\ \{\Delta C(t-1)+C_{stepup},\Delta C_{max}\},\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
* A targeted Block Error Rate (BLER) value of 10%: The choice of this targeted BLER value is guided by the 3 GPP standard Release 13 [49]. This targeted BLER value is considered to be the normal out-of-sync error rate condition for LTE/4G technology during Radio Link Monitoring (RLM) [53].
* The 7% and 13% threshold are typical values for specifying the channel state in an NB-IoT system to be good, medium, or bad. This choice is directly linked to the objective of maintaining the \(\pm 3\%\) margin around the targeted 10% BLER as per the 3 GPP standard specifications [49].
* The \(C_{\mathit{stepup}}\) and \(C_{\mathit{stepdown}}\) values are the incremental compensation step sizes. As in any iterative process, there is a need to choose a reasonable initial step size. The authors have chosen an initial Cstepup value and not a Cstepdown one since the \(C_{\mathit{stepdown}}\) value is modeled first as dependent on being \(C_{\mathit{stepup}}\).
* The initial value of 0.2 for the \(C_{\mathit{stepup}}\) parameter is used to ensure that the MCS level is stepped down when it experiences an initial 20% probability of communication error. This is because 20% is the maximum 3 GPP standard value for BLER when using LTE/4G Technology.  
The proposed algorithm can be summarized as given in Algorithm 1.  
The inner loop part is described between lines 2 \(\longrightarrow\) 8 of the pseudo code as presented by the pseudo-code in Algorithm 1. In this section, the Block Error rate (BLER) for each encoded block is checked every predefined \(T\) period time, against the threshold values of 7% and 13% for good, medium and bad channel states. Depending on the observed type channel condition (good, medium or bad), the channel repetition number \(N\) is either reduced to half, progressively increased by one or doubled respectively.  
The pseudo-code for the outer loop section is described in lines 3 \(\longrightarrow\) 52. The outer loop consists of three scenarios namely,  
* When the Modulation Coding Scheme (MCS) value is between the two predefined threshold values (\(L_{min}<L<L_{max}\)). In this situation, the compensation value \(\Delta C\)) is updated to the lowest or highest value based on whether the transmitter receives positive feedback (\(ACK\)) or negative feedback (\(NACK\)). The MCS level is increased by one or reduced by one accordingly.
* When the MCS reaches the minimum value (\(L_{min}\)), then based on the type of feedback received by the transmitter (\(ACK\) or \(NACK\)) and the position of current repetition number \(N\) in relation to the minimum predefined value \(N_{min}\) and \(N_{Max}\), a new MCS level is defined with an increase of 1 or maintained. The transmission repetition number \(N\) is reduced by half or doubled accordingly.
* Similarity, when the MCS value reaches the maximum value \(L_{Max}\), then based on the type of feedback received by the transmitter (\(ACK\) or \(NACK\)) and the position of current repetition number \(N\) in relation to the minimum predefined value \(N^{min}\), a new MCS level is with a decrease by 1 or maintained accordingly.  
It is important to note that the validity of the proposed EEACC approach is based on the accuracy of our channel conditions assessment. Some key characteristics of this channel condition assessment have been empirically defined and standardized under the 3 GPP standard release 13. The parameter \(\Delta C(t)\) as used within the proposed approach plays the role of a channel characteristic compensation value. This approach is used to determine what level of channel noise and interference need to be suppressed from the current assessed channel conditions to move either to the classification as bad, medium, or good condition as defined in the standard. The \(C_{\mathit{stepdown}}\) and \(C_{\mathit{stepup}}\) parameters, therefore, represent the exact channel coding scheme reduction or increase needed to achieve the \(\Delta C(t)\) channel compensation.  
The choice of \(N/2\) (half of the current repetition value) is a starting value for the algorithm to run from. This is done to represent a scenario in which the error rate has reduced (channel conditions have improved). The repetition number by half as a way to reduce re-transmission attempts and improve energy efficiency. If the reduction is found to be too large, the algorithm will self-adjust the value back to a higher value than \(N/2\). Similarly, in the medium channel condition, the repetition number by 1 as a starting point. Naturally, the algorithm will swing between the repetition numbers in one of the two other cases. In the same way, when the channel condition is deemed to have worsened, the repetition number as a starting point is doubled as an extreme case if it is experienced to be too large, it will naturally self-readjust on the next transmissions.  
```
1:Initialization:\(BLER_{target}=10\%\), \(C_{stepup}=0.2\), \(C_{stepdown}=C_{stepup}\frac{1-BLER_{target}}{BLER_{target}}\), \(\Delta\) C=0, \(\Delta C_{max}=+5,\Delta C_{min}=-5,\text{MDS}\) level \(L\) and its bounds \(L^{max}\), \(L^{min}\), repetition number \(N\) and its bounds \(N^{max},N^{min}\). We empirically initialize the MCS level and repetition number based on the channel condition.
2:if period T expired out then
3:if\(BLER<7\%\)then
4:\(N=N/2\)
5:elseif\(7\%<BLER>13\%\)then
6:\(N=N+1\)
7:elseif\(BLER>13\%\)then
8:\(N=2N\)
9:endif
10:endif
11:if\(L>L^{min}\delta L<L^{max}\)then
12:ifHARO feedback=ACK then
13:\(\Delta C=min\Delta C+C_{stepup},\Delta C_{max}\)
14:elseifHARO feedback=NACK then
15:\(\Delta C=max\Delta C-C_{stepdown},\Delta C_{min}\)
16:endif
17:if\(\Delta C=\Delta C_{max}\)then
18:\(L=L+1\)
19:if\(\Delta C=\Delta C_{min}\)then
20:\(L=L-1\)
21:endif
22:elseif\(L=L^{min}\)then
23:ifHARQ feedback=ACK then
24:if\(N=N^{min}\)then
25:\(\Delta C=min\Delta C+C_{stepup},\Delta C_{max}\)
26:if\(\Delta C=\Delta C_{max}\)then
27:\(L=L+1\)
28:endif
29:if\(N>N^{min}\)then
30:\(N=N/2\)
31:endif
32:elseifHARQ feedback=NACK then
33:if\(N=N^{max}\)then
34: the current channel condition is very bad
35:elseif\(N<N^{max}\)then
36:\(N=2N\)
37:endif
38:endif
39:elseif\(L=L^{max}\)
40:ifHARQ feedback=ACK then
41:if\(N=N^{min}\)then
42: the current channel condition is very good.
43:elseif\(N>N^{min}\)then
44:\(N=N/2\)
45:endif
46:elseifHARQ feedback=NACK then
47:\(\Delta C=max\Delta C-C_{stepdown},\Delta C_{min}\)
48:if\(\Delta C=\Delta C_{min}\)then
49:\(L=L-1\)



It is also quite critical to mention that, although small, the execution latency of the proposed algorithm has been assessed to form part of the overall up-link communication. This execution duration could be assumed to be quite negligible simply because of the remarkable progress that we now observed in the processing speed of nowadays micro-controllers. With the capability to be interfaced with clock frequencies of few dozens of MHz, nowadays microcontrollers that form the processor of the NB-IoT nodes, could have sampling speed of up to 70 MHz meaning sampling times of about 14.3 ns [54]. However, for our proposed research, the computational latency has been assessed as follows,

* Let us assume that the CPU of the NB-IoT node's processor is running at a clock frequency of \(f_{clk}\).
* Let also assume that the CPU has a machine cycle equal to \(m\) clock pulses (periods).
* The duration of a single machine cycle can be computed as \(T_{mc}=\frac{m}{f_{clk}}\).
* Going from the principle that for a multi-cycle Microprocessor without Interlocked Pipelined Stages (MIPS) which considers the following five types of instructions with their respective number of machine cycles,

* Load (5 cycles)
* Store (4 cycles)
* R-type (4 cycles)
* Branch (3 cycles)
* Jump (3 cycles)
* By using a MATLAB R2019b Instruction Classification Learner application (Table 1), it was found that the program has the algorithm implementing the EEACC algorithm has an average total instruction count of \(n=15\) instructions and the following percentages of instructions per type.

This leads to an average of Cycles per instructions (CPI) of \(CPI=\frac{5\times 52+23\times 4+14\times 4+9\times 3+2\times 3}{100}=4.41\) The execution time of the algorithm can be computed as follows:

\[T_{Ex}=CPI\times n\times T_{mc}=4.41\times 15\times\frac{m}{f_{clk}} \tag{28}\]

This means that for the implementation on a typical NB-IoT node with a basic cheap microcontroller such as the PIC16F627A running a on a external crystal oscillator with a clock frequency \(f_{clk}=16\) MHz with \(m=4\) clock cycles per machine cycle, the execution time of the EEACC algorithm can be computed as follows,

\[T_{Ex}=4.41\times 15\times\frac{4}{16\times 10^{6}}=16.5375\ \upmu\text{s} \tag{29}\]

This processing duration significantly reduces with faster modern microcontrollers.