# Renewable Energy-Based Energy-Efficient Off-Grid Base Stations for Heterogeneous Network
## 2 System Architecture and Mathematical Modeling
### Resource Scheduling Algorithm
#### 2.9.2 Psm (Power Saving Mode)  
PSM permits UE to reduce power consumption to the most bottom level by transferring its circuitry into a deep sleep mode. However, still, the device is registered to the system. DL or MT data transfer requests cannot be scheduled in this mode because the device is inaccessible for the BS. On the other hand, for MO or UL data, the transfer device leaves the PSM mode at an instance. Moreover, it also wakes up if a request comes for a routing area update (RAU) or TAU. After every entry of PSM mode, at first the device runs some active timers when MT data transfer can also be scheduled by monitoring the paging channel. For NB-IoT applications, the battery lifetime is a vital issue. On the other side, the downlink latency does not have any significant importance for NB-IoT applications and infrequent paging is sufficient to monitor it. For NB-IoT applications, the PSM cycle timer supports deep sleep up to 413 days.  
In this paper, a scheduling algorithm for the communication between BS and NB-IoT application devices using PSM and eDRX is proposed in Algorithm 2. After the end of the data transfer, an inactivity timer will start. If the inactivity timer can reach its end without any data packet arrival, the eDRX cycle will start. The eDRX cycle consists of some short and some extended long cycles. If the eDRX cycle can run-up to the end, the PSM will start. The UL data transfer request of TAU during the sleep period can restart the full cycle by starting the ON or data transfer active period. DL/MT data transfer can start the ON period if and only if it can reach the inactivity timer or paging period. To calculate the percentage of power saving, we have used the following equation, which has been modified from [61].  
```
1: Initialize: \(\tau_{D}\), \(\tau_{S}\), \(\tau_{L}\), \(\tau_{st}\), \(t_{eDRX}\), \(\tau_{i}\), \(\tau_{i}^{\prime}\), \(\tau_{eDRX}\), \(\tau_{eDRX}^{\prime}\), \(\tau_{PSM}^{\prime}\), \(\tau_{PSM}^{\prime}\), \(\chi_{i_{UL/DL}}\), and \(\chi_{i_{UL}}\).
2:for\(i=1:k\)
3:while\(\chi_{i_{UL/DL}}>0\)
4: Start data transfer (\(\tau_{D}\))
5: update \(\chi_{i_{UL/DL}}\)
6: enable inactivity timer (\(\tau_{i}\))
7:if\(\chi_{i_{UL/DL}}>0\) && \(\tau_{i}<\tau_{i}^{\prime}\)
8: Go to Step 3
9:else
10: enable \(\tau_{eDRX}\)
11:for\(j\)=1:N
12: check \(\chi_{i_{UL/DL}}\) in every \(\tau_{S}\) interval
13:if\(\chi_{i_{UL/DL}}>0\)
14: Go to Step 3
15:else
16: j=j+1
17: check \(\chi_{i_{UL/DL}}\) in every \(\tau_{L}\) interval
18:if\(\chi_{i_{UL/DL}}>0\) && \(\tau_{eDRX}>\tau_{eDRX}^{\prime}\)
19: Go to Step 3
20:else
21: Continue (\(eDRX\))
22: enable Power Saving Mode (\(\tau_{PSM}\))
23:if\(\chi_{i_{UL}}>0\)
24: Go to Step 3
25:else
26: Continue (\(\tau_{PSM}\))
27:\(i=i+1\)
```  
**Algorithm 2** Algorithm for the communication between \(i\)th IoT device and BS\[P_{Save}(\%)=\left[1-\left[\frac{E[T_{Data}]}{E[T_{Total}]}+\frac{P_{ Inactive}\times E[T_{Inactive}]}{P_{Data}\times E[T_{Total}]}\right.\right.\] \[\left.\left.+\frac{P_{eDRX}\times E[T_{eDRX}]}{P_{Data}\times E[T_ {Total}]}+\frac{P_{PSM}\times E[T_{PSM}]}{P_{Data}\times E[T_{Total}]}\right] \right]\times 100\]