# Cross-Cycled Uplink Resource Allocation over NB-IoT
## 3 Cross-NP Uplink Resource Allocation
### Algorithm Description
When the subframe allocation is finished for UE \(d^{\prime}\), if the resource assignment index \(h\) is larger than or equal to 1, we set the corresponding parameters and call the NSF-Adjustment() function (Lines 18-25). The NSF-Adjustment() function is designed to reduce the number of allocated units for UE \(d^{\prime}\) if a sacrificed unit from UE \(d^{\prime}\) can be used to serve more UEs. When the resource assignment is adjusted, we allocate the number of \(f_{u^{\prime}}\) subcarriers through continuous \(I_{d^{\prime}}^{h}\cdot t_{u^{\prime}}\cdot N_{d^{\prime}}^{u^{\prime},m^{\prime }}\) subframes (Lines 20-21). If we allocate subframes of the next NP (i.e., \(t_{i^{\prime}}^{e^{\prime}}+\sigma>L\)) for UE \(d^{\prime}\), \(DCIC_{P+1,d^{\prime}}^{0}\) is set as true to denote that the UE cannot be scheduled in the next NP because the UE cannot monitor its search space (Lines 22-23). Because DCI \(c^{\prime}\) in the \(P\)-th NP is assigned to UE \(d^{\prime}\), \(DCIC_{P,d^{\prime}}^{c}\) is set to 1 (Line 24), and the data requirement of UE \(d^{\prime}\) is decreased by \(\eta(I_{d^{\prime}}^{h},m^{\prime})\) (Line 25). When the radio resources of an NP are exhausted, or no UE should be served, the number of used NPs is increased by 1 (Line 26). Then, we check that if the data requests of all UEs are fulfilled, the algorithm is terminated, and the five parameters are returned (Lines 27-29). The Transmission-Performance() function (Algorithm 2) calculates table \(v(d,u,m)\). In Line 2, we initialize \(v(d,u,m)\) to \(-\infty\) as unavailable, \(\forall d,u,m\). Then, this function estimates whether UE \(d\) can use resource unit type \(u\) and modulation strategy \(m\) to achieve the required reliability. If the required reliability cannot be met, the number of repetitionsused for transmitting data \(N_{d}^{u,m}\) is \(-1\), and we look for the next combination (Lines 6-7). Otherwise, the UE can transmit data using the unit type with the modulation, and we calculate its spectrum efficiency recorded in \(v(d,u,m)\) in Lines 8-16. In Line 8, the resource assignment index \(h\) is initialized as 0. Then, the function checks whether this NP has sufficient subframes for each unit type, and the need for UE \(d\) is sufficient (in Lines 9-16). In every test, index \(h\) is increased by one until the maximum number of \(I^{H}\) resource units is achieved (Lines 9-10). In Line 11, UE \(d\) transmitting \(I^{h}\) units with type \(u\) and modulation strategy \(m\) requires \(I^{h}*t_{u}*N_{d}^{u,m}\) NPUSCH subframes. Because an NP that crosses over the next NP has \(L\) subframes at most, \(I^{h}*t_{u}*N_{d}^{u,m}\leq L\) means that UE \(d\) can deliver \(\eta(I_{d}^{h},m)\) bits in this NP. The spectrum efficiency \(v(d,u,m)\) is \(\eta(I_{d}^{h},m)/I^{h}*t_{u}*N_{d}^{u,m}\) (Lines 11-12). Otherwise, we terminate the while loop because this NP does not have sufficient resources for using this unit type and modulation (Lines 15-16). If the number of \(I^{h}\) resource units can satisfy the need of UE \(d\), we also terminate the while loop (Lines 13-14). When we complete \(v(d,u,m)\), this function returns \(v(d,u,m)\) in Line 17. ```
1 FunctionTransmission-Performance(): \(v(d,u,m)=-\infty,\forall d,u,m\)
2 for\(d=1\) to \(D\)do
3 for\(u=1\) to \(U\)do
4 for\(m=1\) to \(M\)do
5 if\(N_{d}^{u,m}=-1\)then
6 continue
7\(h=0\)
8 while\(I^{h}<I^{h}\)do
9\(h=h+1\)
10 if\(I^{h}\times I_{u}\times N_{d}^{u,m}\leq L\)then
11\(v(d,u,m)=\eta(I_{d}^{h},m)/I^{h}\times t_{u}\times N_{d}^{u,m}\)
12 if\(\psi_{d}\leq\eta(I_{d}^{h},m)\)then
13 break
14 else
15 break
16
17 return\(v(d,u,m),\forall d,u,m\)
```  
**Algorithm 2**Transmission-Performance():  
The Subframe-Allocation() function (Algorithm 3) calculates the number of \(I_{d^{\prime}}^{h}\) units that can be continuously allocated for UE \(d^{\prime}\) using unit type \(u^{\prime}\) with modulation \(m^{\prime}\) from NPUSCH start subframe \(t_{f}^{c^{\prime}}\). In Line 2, variable \(\sigma\) is initialized to \(-1\).