Availability-Reliability-Stability Trade-Offs in Ultra-Reliable Energy-Harvesting Cognitive Radio IoT Networks

With the rise of the Internet-of-Things (IoT), new requirements have been brought into communication networks to make them more efficient, sustainable, and self-sufficient. Requirements, such as availability and ultra-reliability combined with the solutions of energy-harvesting and dynamic spectrum access, make the analyses of such networks more complex, while imposing different performance trade-offs. This paper analyzes the performance of ultra-reliable energy-harvesting cognitive radio Internet-of-Things (UR-EH-CR-IoT) networks, and provides analytical derivations for different IoT network metrics, such as GoodPut, reliability, collision probability, availability, and stability, so as to investigate their trade-offs. A new metric for network availability is defined based on energy availability and spectrum accessibility for UR-EH-CR-IoT networks, while incorporating transmission diversity. The effect of IoT network parameters, such as sensing time, diversity transmission, and number of packets in a data frame, is examined on the IoT network performance metrics. Lastly, the derived expressions are utilized to optimize the GoodPut, subject to various practical constraints.


I. INTRODUCTION
Internet-of-Things (IoT) has recently emerged as a promising paradigm for forming globally connected smart devices, systems, and networks [1]. The nodes in IoT networks are expected to provide reliable services and network connectivity anytime-anywhere, and therefore, reliability, lowlatency, and availability have become basic and critical performance attributes in IoT networks [2]. On the other hand, communication systems are limited by the scarcity of spectrum and energy. In turn, cognitive radio (CR) has been introduced as a key technology to improve spectrum utilization through dynamic spectrum access by co-existing with licensed users [3]. Moreover, energy-harvesting (EH) technologies have received significant attention due to their ability to energize wireless networks via renewable energy resources [4]. Hence, incorporating CR and EH solutions into IoT networks is considered a major step towards The associate editor coordinating the review of this manuscript and approving it for publication was Amjad Mehmood . self-sufficiency and sustainability of such networks [5]. Recently, a lot of applications have been envisaged in IoT, in which ultra-reliable (UR) communication is a must; for instance, in Industrial IoT (IIoT) [6]- [9]. Particularly, IIoT-based applications are heavily dependent upon UR communications as well energy-and spectrum-efficient transmission techniques. Moreover, wearable and on-body early-warning IoT networks [10]- [12], and Geo-hazards prevention IoT systems [13] are applications that require careful consideration and design, since no permanent and/or dedicated energy and spectrum sources may be available to them due to their remote installation and/or portable configuration. Therefore, analyzing UR-EH-CR-IoT networks and investigating their network metrics are of prominent importance.

A. RELATED WORKS
Energy-harvesting cognitive radio networks have been considered in many studies recently and different network utilities have been analyzed in a variety of scenarios.
For instance, a narrowband IoT network with random-access CR users has been considered in [14], where the authors derived a unique set of optimal sensing parameters to maximize network throughput. In [15], network metrics such as GoodPut, collision probability and network stability have been investigated in an EH-CR-IoT network. Average endto-end delay of packets as well as delay violation probability in the IoT network have been mathematically formulated and analyzed. Moreover, the effect of the energy-harvesting rate on GoodPut and IoT network stability has been also explored. In [16], a cognitive machine-to-machine communication network through underlay spectrum sharing mode with EH-IoT devices have been investigated for throughput performance. Analytical expressions of throughput and successful decoding probability are derived.
However, to the best of our knowledge, ultra-reliable transmissions in EH-CR networks have not been thoroughly studied. In fact, only few researchers have studied UR communications in spectrum sharing and CR networks. For example, an adaptive channel assignment method based on machine-learning along with fountain codes is proposed in [17] to reduce transmission latency, and ensure reliability in licensed and unlicensed spectrum bands for ultrareliable low-latency communication (URLLC). Particularly, the authors proposed switching the critical data to the licensed spectrum with the best channel conditions, and the noncritical data to the least congested unlicensed spectrum. Each band was selected based on the its past access experiences. A framework to design, configure, and deploy a reliable ultralow power wireless sensor networks is proposed in [18], with the goal of achieving improved energy-efficiency, latency, and reliability. An in-depth energy model of the sensor node were presented, and validated through measurements. Furthermore, three error correcting techniques have been studied, and compared in terms of energy consumption, latency, and reliability. An URLLC for factory automation (FA) via combination of unlicensed and licensed bands has been addressed in [19]. To ensure reliable transmissions, a coexistence management scheme with the cellular network as an incumbent network has been devised. Specifically, the FA application was time-synchronized to the cellular network, and collocating nodes were exploited to prevent interference. Opportunistic transmission for UR interweave CR networks has been analyzed in [20]. To achieve UR communication, an automatic-repeat-request (ARQ) scheme has been adopted for secondary users (SUs). Optimum access probabilities and SU transmit power based on the primary user (PU) arrival rate, and the target error rate have been derived under perfect spectrum sensing. It was assumed that both PUs and SUs are served by the same basestation (BS), which applies ARQ and successive interference cancellation (SIC) on the SU packet. Once the BS decodes the SU packet, it applies SIC to eliminate interference from the PU packet and subsequently, reduce the error outage probability for the PU. Opportunistic spectrum access in underlay CR networks to achieve URLLC has been analyzed in [21].
By adopting an ARQ scheme for secondary transmissions, the maximum achievable rate, the approximate rate at high signal-to-noise ratios (SNRs), and the optimal SU average transmit power under statistical received power outage constraint have been achieved. Implementation challenges and operational issues with IoT devices in 5G URLLC networks are studied in [9]. Specifically, the authors discussed different problems related to quality-of-service, packet design, scheduling, error handling and beamforming. Furthermore, they have addressed the importance of URLLC both in the categories defined by ITU and other research areas, including medical and health-care, intelligent transport systems, and industrial automation. To achieve reliable connectivity among wearable IoT devices in health-care networks, an energy-harvesting protocol that harvests energy from two ambient energy sources, radio frequency (RF) and thermal energy, has been devised in [10].

B. MOTIVATION
Since both harvested energy and shared spectrum are stochastic in nature, investigating the availability and reliability of EH-CR-IoT networks is of the essence. Although several studies have focused on UR communications, to the best of our knowledge, no study paid attention to availability and reliability in EH-CR-IoT networks. In communication systems, reliability is usually defined based on bit error rate (BER), block error rate (BLER), packet loss rate, or interference probability [22]. On the other hand, availability is usually defined based on system failure metrics, such as mean up time (MUT), and mean time to first failure (MTFF). Recently, some authors have brought the availability concept to the space domain by defining mean covered area (MCA), and mean uncovered area (MUA) [23]- [25]. In CR networks, availability is defined as the mean time (or probability) that a shared channel is available [26]. However, this definition is not complete, because it should be defined from the perspective of SUs as well. Particularly, the sensing performance along with channel availability should be incorporated into the definition. To define such measure, energy availability should be also included in the availability analyses. This makes the mathematical derivations complex, since energycausality and data-causality must be observed simultaneously, which still an open issue in EH-CR-IoT networks.
The key point in EH-CR-IoT networks is that it is not enough to assume that energy-causality constraint on a frame is satisfied, as most researchers do [27]- [35]. Such assumption is conservative and cannot provide much insight into the understanding important IoT network metrics, such as stability, reliability, and availability. This is because if such constraint is not met in a certain time span, say in a transmission frame, the accumulated harvested energy should be considered for the next frames. On the other hand, if no data exists in the IoT transmitter buffer, the energy must be preserved for potential incoming data and transmission in later frames. This means that energy availability is not only dependent on the energy arrival profile, but also on data arrival profile. To clar- VOLUME 8, 2020 ify, one can consider a system with sporadic data arrival. Such system has higher energy availability (and hence higher availability) than a saturated data profile one in a certain energy arrival pattern, since the average energy in the storage is higher due to less energy consumption for data transmission. Therefore, both data-and energy-causality should simultaneously be taken into account. Nevertheless, note that dataand energy-causality are well-addressed in the mathematical analyses of wireless powered (or RF energy-harvesting) communications [36]- [40], and in simulation-based algorithmic-proposed scenarios [41]- [44]. However, analyzing EH-CR-IoT networks with renewable energy resources is still in its infancy.
Ultra-reliable IoT networks have become one of the most promising paradigms in many future applications; for instance, in IIoT [6]- [9]. To achieve UR communications, several techniques have been proposed in the literature; such as, ARQ-based protocols [20], [45], power control strategies to mitigate interference power [21], [46], [47], relay-based techniques [48], [49], and diversity transmissions [50]- [52]. However, from an implementation perspective, although each approach has its own pros and cons, diversity transmission is the simplest to implement in UR networks, or even modify an existing network operation/configuration to an ultra-reliable one, as it requires no changes to the hardware or framing. 1 This is another motivation to analyze an UR-EH-CR-IoT network based on diversity transmission.

C. CONTRIBUTIONS
In this paper, an EH-CR-IoT network with UR communication is considered. Specifically, transmission diversity is adopted to achieve the target reliability, while data and energy arrival profiles are incorporated into the IoT network metrics, such as GoodPut, availability, and network stability. The effect of harvested energy has not been factored into the definition of these metrics before, while such IoT network metrics are profoundly affected by the energy level of the EH IoT nodes. A cellular network with dynamic and non-dynamic traffic behavior is assumed as the primary user network, and the effect of PU traffic behavior on the IoT network metrics is investigated. To comply with the ITU standards [53], a new availability metric is defined, which takes energy availability, spectrum availability, and sensing accuracy into account, and thus forms a complete measure for the availability of UR-EH-CR-IoT networks. Furthermore, data-and energy-causality are considered alongside each other to investigate the effect of harvested energy on GoodPut, availability and stability. Furthermore, the energy overflow in the IoT node's storage is considered to model a realistic scenario. The probability distribution of the frame transmission time is derived, while considering randomness of the energy arrival profile along with spectrum sensing parameters, and PU traffic behavior. 1 This can be seen by noting that diversity transmission is only based on transmitting a fixed number of packet replicas. To the best of our knowledge, there are no existing results on the implementation complexity of diversity transmission.
The availability-reliability-stability trade-offs are also investigated through numerical results. In deriving reliability, both channel error and interference due to sensing error (missdetection and PU-return) are taken into account [54], [55]. The main contributions of this work are summarized as follows: • Considered an EH-CR-IoT network with UR communication through transmission diversity, where IoT network metrics-such as GoodPut, collision probability, availability, reliability and stability-are analytically derived. Both data and energy arrival profiles are incorporated in the analyses to investigate the effect of dataand energy-causality on the IoT network metrics.
• Examined the effect of PU traffic behavior (i.e. idle and busy rates), and interference due to PU-returns and spectrum sensing errors, in the derivation of GoodPut and reliability.
• Derived the distribution of frame transmission timeconsidering the energy arrival and energy consumption profiles as well as the dynamic spectrum sensing inaccuracy-and through which the expected number of packets in the IoT node's buffer is explored.
• Defined a new metric for network availability-based on energy availability and spectrum accessibilityto reflect the complete concept of availability, while accounting for data-and energy-causality simultaneously.
• Explored the availability-reliability-stability trade-offs in the UR-EH-CR-IoT network. Particularly, the availability, reliability, stability and GoodPut are studied for various numbers of packets in a data frame, and transmission diversity. Additionally, the effect of sensing duration is also examined, which takes into account interference due to sensing inaccuracy and PU-returns.
• Utilized the analytical derivations to optimize the Good-Put, subject to constraints on the collision probability, availability, reliability and network stability, which are based on the analytical derivations. The rest of this paper is organized as follows. Section II introduces the system model. The analytical derivations of the different IoT network metrics are given in Section III. Numerical results are presented in Section IV. In Section V, the GoodPut maximization optimization problem is formulated, solved, and supplemented with additional simulation results. Further discussions on the analyzed network metrics are presented in Section VI. Finally, conclusions are drawn in Section VII.

II. SYSTEM MODEL A. IoT NETWORK MODEL
Consider an IoT network, where the IoT devices/nodes scavenge environmental energy, and operate under the interweave spectrum sharing cognitive radio discipline [56], [57], with the aim of improving energy and spectrum efficiencies as well as achieving ultra-reliable communication. The IoT nodes (as SUs) transmit their data in a frame-based structure, in which the time is divided into slots, called frames. Each frame consists of two phases, namely the sensing phase and the transmission. 2 At the beginning of each frame, the secondary ''IoT'' transmitter (ST) starts sensing the spectrum to find a spectrum hole for transmitting its data packets, if there is at least one data packet in its buffer; otherwise, it remains idle. The sensing and transmission phases last for T s and T tr seconds, respectively, and the total frame duration is denoted T f = T s +T tr . Based on the sensing result, the IoT transmitter decides either to send data in the transmission phase, if the channel is sensed idle, or wait for the next frame, if the channel is sensed busy. Due to spectrum sensing uncertainty, there is always the possibility of sensing errors. The spectrum sensing performance is modeled by two error probabilities, namely false-alarm (P f ) and miss-detection (P m ), which have been extensively studied in the literature. 3 Specifically [58], where Q (·) is the Q−function, α = Q −1 (1 − P m ) √ 2γ T + 1, and β = γ T √ f s , with γ T being the received signal-to-noise ratio (SNR) at the secondary IoT transmitting node, while f s is the sampling frequency.
The duration of each data packet (i.e. packet time) is assumed to be of T p seconds. During a packet time, the ST transmits B p bits to its intended user. Therefore, the maximum number of packets that can be sent in a frame is given by N = T tr /T p . Note that if there are less than N packets in the buffer, the rest of the transmission phase will be zero padded. For UR transmissions, and to ensure packet's successful reception, the ST exploits diversity transmissions; that is, each frame is sent multiple times, say N rep times, in the next N rep idle-sensed successive frames.
Remark 1: During the transmission phase, a frame collision may happen due to the PU returning to the spectrum (i.e. a PU-return) [55], [60].
Remark 2: The traffic behavior of the IoT node for generated data packets follows a Poisson arrival process with rate λ d . 4

B. PRIMARY NETWORK MODEL
The primary network is assumed to be cellular, and the traffic behavior of which is modeled as a two-state continuous-time Markov chain (CTMC) with busy and idle rates of λ 1 and λ 0 , respectively. 5 The stationary probability of the busy and idle states are given by π 1 = λ 0 λ 1 +λ 0 and π 0 = λ 1 λ 1 +λ 0 , respectively [68]. Moreover, the transition probabilities from the busy state to the idle state during t seconds, and vice versa are given by [68] and respectively, while the remaining chain probabilities are and Lastly, let the state of a channel at the beginning of the n th frame be denoted by S n ∈ {0, 1}, in which 0 and 1 are assumed for the idle, and busy states, respectively.

C. ENERGY CONSUMPTION MODEL
At each IoT node, energy is assumed to arrive randomly at each frame in the form of quantized energy packets, each with ξ amount of energy. To model its randomness, assume that the number of harvested energy packets at each frame follows an independent and identically distributed (i.i.d) stationary random process. Specifically, the number of harvested energy packets is modeled as a homogeneous Poisson counting process with rate λ e . Thus, the expected value of the harvested energy during a frame is given by λ e T f ξ . Also, let the probability of e energy packets arriving during a frame be denoted P pkt E (e), for e ∈ {0, 1, . . .}. 6 The harvested energy is then stored in a rechargeable battery with finite-capacity. In turn, the battery energy level at the beginning of the n th frame is a random variable, which is denoted L n . Specifically, the battery energy level is quantized into a set of finite discrete values, i.e., L n ∈ {0, 1, . . . , L max }. Moreover, let the amount of energy in each battery level be given by ε, and thus, the battery capacity equals L max ε. Additionally, the power consumption profile of each IoT node includes sensing power P s , transmit power P tr , and circuitry power consumption P c when the IoT node awaits the next frame to find a spectrum hole.
The minimum battery energy level for transmitting a data frame is given by tr = P s T s + P tr T tr ε . Additionally, the IoT node consumes w = P s T s + P c T tr ε energy levels of its battery if it does not succeed to send data, and has to wait for the next frame. It should also be noted that in deriving (6) and (7), the energy level of battery has been calculated, rather that the energy of the battery, which is obtained by dividing the total energy by ε. This will come in handy in the derivations presented in subsection III-E, and the following subsections. Before analyzing the EH-CR-IoT network metrics, the main symbols used in this paper as well as their descriptions are given in Table 1.

III. ANALYTICAL DERIVATIONS
In this section, the analytical derivations of the different network metrics are given.

Definition 1 (Transmission Cycle): A transmission Cycle
T cycle is the time interval during which a typical frame and its replicas are transmitted, which also incorporates all the waiting frames due to PU presence. Thus, this cycle lasts at least N rep × T f seconds if the channel is sensed idle in all N rep successive replicas of a frame.
Definition 2 (GoodPut): GoodPut η GP is defined as the average successfully perceived rate R s at the IoT receiver, which is equivalent to the ratio of the average of successfully transferred bits of a typical frame, i.e. E [R s ], to the average transmission cycle of a typical data frame, E T cycle . 7 Definition 3 (Reliability): Reliability is defined as the probability P R that a frame is transmitted and received successfully at the IoT node receiver, i.e., without any interference and/or channel error.
Definition 4 (Network Availability): Network availability P NA is the probability that a communication network is available to the IoT transmitter node whenever it intends to transmit data frames.
Definition 5 (Frame Type): The following frame types are defined in the network: A frame at the beginning of which there exist i data packets (for i = 1, 2, . . . , N − 1) in the IoT node's buffer. From a steady-state perspective, a typical frame is of type F i with the probability of P F i . 8 Frame N + (F N + ): A frame at the beginning of which there exist at least N data packets in the buffer of the IoT node. From the steady-state perspective, a typical frame is of type F N + with the probability of P N + ∞ i=N P F i . Before providing any analytical derivations, it is important to note that our network model incorporate two types of communication links, namely PU-IoT and IoT-IoT. Particularly, the PU-IoT link is dependent on spectrum sensing, which is influenced by the complex-valued PU signal and the circularly symmetric complex Gaussian noise of the channel, as per (1). As for the IoT-IoT link, it is generally characterized by the bit error rate, P BER , at the receiver ''IoT'' side. This way, channel model-free expressions can be derived. In other words, for any type of channel existing between the IoT nodes, one can calculate the bit error rate based on the specific characteristics of the corresponding channel, and substitute it into the derived expressions, as will be illustrated shortly.

B. GOODPUT
Before the GoodPut is derived, the probability that a typical frame is finally received successfully after N rep re-transmissions must first be determined, which is obtained as per Lemma 1.
Lemma 1: The probability that a typical frame is received successfully is given in (8), as shown at the bottom of the next page, where P BER is the channel's bit error rate.
Proof: See Appendix A. The GoodPut is determined as per Lemma 2.

Lemma 2:
The average number of successfully transferred bits η GP by an IoT node is determined as where B p is the number of bits per packet. 9 Proof: See Appendix B.

C. RELIABILITY
Based on Lemma 1, the network reliability P R is obtained according to Lemma 3.

Lemma 3:
The reliability of the IoT network is obtained as where P F 0 is the probability that a frame is empty (i.e. no packets exist in the IoT node's buffer).
Proof: See Appendix C.

D. COLLISION PROBABILITY
Collision probability P coll is a very important metric in dynamic spectrum access transmissions, which is imposed on the SUs to minimize collisions, and guarantee minimum rate in the primary network. Specifically, it is defined as where T int is the total interference time, including interference due to both sensing errors and PU-returns; whereas, T tr is the total IoT node's transmission time. The probability of collision is determined as per Lemma 4. Lemma 4: The probability of collision is determined as where I 0 (T tr ) is the expected duration of interference due to T tr seconds of IoT node's transmission, while the channel is correctly sensed as idle, 10 as given by [60], [71] Proof: See Appendix D. 9 It should be noted that E[T cycle ] is determined later in Remark 4. 10 This kind of interference occurs because of PU-returns.

E. NETWORK STABILITY AND PACKET LATENCY
The aim of this subsection is to derive the frame latency of the IoT node, considering its energy level and diversity transmission. Particularly, the Discrete Phase Type Distribution is exploited to model the distribution of the frame transmission time [72]. In turn, a state diagram is devised for the frame of interest (i.e. to be transmitted), as illustrated in Fig. 1.
The transmission time distribution encompasses the waiting time for the IoT node to find a spectrum opportunity, and all the frames during which the IoT node waits to scavenge sufficient energy levels for transmission. In the state diagram shown in Fig. 1, the states are defined as (S n , L n ), which resemble the channel (i.e. S n ∈ {0, 1}), and the states at the beginning of n th frame (i.e. L n ∈ {0, 1, . . . , L max }). Specifically, the green states indicate those with enough transmission energy level (i.e. L n ≥ tr ), while the gray states refer to those without enough energy levels. For the sake of simplicity, define which denotes the transition probability from state (S n = i, L n = l) to state (S n+1 = j, L n+1 = m), and each transition matches to T f seconds. Also, define two additional states, namely Start Transmission (ST ) and End Transmission (ET ), which are not depicted in the figure to minimize clutter. The former state indicates the start of spectrum sensing, while the latter implies the end of transmission. Thus, the transition probabilities of the states are obtained as per Lemma 5.
Lemma 5: The inter-state transition probabilities in Fig. 1 are determined as given in (15), as shown at the bottom of the next page, in which π L (m) is the steady-state probability that the battery energy level equals m (for m ∈ {0, 1, . . . , L max }) 11 at the beginning of a frame, and I(x) is a binary indicator function, defined as Proof: See Appendix E. The number of hops from state ST to ET is a random variable representing the number of frames that the IoT transmitter must wait to send a typical data frame, considering its energy level and spectrum opportunities. To draw its probability distribution, the state diagram is formulated as a Phase Type Distribution denoted by P(ω ω ω, ) [72]. Specifically, ω ω ω is the initial probability vector of entering the state diagram, and is the probability transition matrix of the state diagram 11 Note that π L (m) is determined in subsection III-G. excluding the ST and ET states. Each (i, l) state of the aforementioned 2D diagram can be mapped into a unique 1D state diagram by the mapping function r = 2l +i+1, for i ∈ {0, 1}, and l ∈ {0, 1, . . . , L max } (i.e. r ∈ {1, 2, . . . , 2(L max + 1)}). Therefore, the r th element of ω ω ω is given by while the elements of are determined as 12 where 12 Notably, is a 2(L max + 1) × 2(L max + 1) matrix, with row and column indices given by r and s, respectively. and The probability density function (PDF) for the time of transmitting a single frame, denoted S, is expressed as [72] f where 1 denotes a column vector of 1's. Note that the PDF of the time of transmitting all replicas of a frame is equal to the N rep -fold convolution of f S (t), which is denoted by f rep S (t). Remark 3: Due to the closure property of the Phase Type Distribution [73], the N rep -fold convolution PDF f rep S (t) is also a Phase Type Distribution. More importantly, the corresponding initial probability vector ω ω ω rep and transition probability matrix rep can be derived iteratively.
Remark 4: By taking the expectation of the time of transmitting all N rep replicas of a frame, with PDF f rep if l ≥ tr and i = 0 and m = L max , (j,m) and the expected value of the transmission cycle is obtained as [72], which is used in the derivation of η GP . Lemma 6: The steady-state probabilities P F i are obtained recursively as where and with I being the identity matrix. Also, (20), is determined by solving the following equations set whereḢ is derived in Lemma 7. Lastly, z l (for l = 1, . . . , N ) are obtained using Rouché theorem [74] as the zeroes of Proof: See Appendix F. Based on all the above, the network stability measure ρ (also known as the IoT network utilization), and the average number of data packets in the IoT node's buffer E [D] are determined according to Lemma 7 Lemma 7: The IoT network stability measure ρ is obtained as while the average number of data packets in the IoT node's buffer E[D] is determined as given in (25), as shown at the bottom of this page, wherė and Proof: See Appendix G.  [68].

F. NETWORK AVAILABILITY
The network availability (NA) metric is defined based on the resources required for the EH-CR-IoT network to operate, which would not happen unless the minimum required energy, and its designated spectrum are available to the IoT nodes. Besides, the availability of energy depends on both the EH rate and data arrival profile, since data usage determines how much energy is consumed. On the other hand, spectrum availability is not only based on channel utilization by the PU, but also on the spectrum sensing accuracy. In turn, the steadystate network availability P NA is defined as According to (28), the network is fully available to a typical EH-CR-IoT node (i.e. P NA → 1) when the spectrum is always available (e.g. a TV white space scenario), and the user does not false-alarm the idle state of the channel (requiring very accurate spectrum sensing or long enough sensing time), and also there is always enough energy for data transmission. Contrarily, if the shared licensed band is very busy and occupied most of the time by the PU, or the IoT node misses transmission opportunities permanently (e.g. it cannot sense the spectrum accurately), or the harvested energy from the environment is not enough for such nodes to transmit data, then the network will not be available (i.e. P NA → 0).

G. EXTRACTING SUBMETRICS
In this subsection, the probability metric π L (m) for m ∈ {0, 1, . . . , L max } is derived; but first, let us define a chain and prove its Markovian property. Consider the stochastic process X n (S n , L n , G n ), for (n = 0, 1, . . .), in which G n ∈ {0, 1, . . .} represents the number of backlogged data packets in the IoT node's buffer at the beginning of the n th frame. For the stochastic process X n , Lemma 8 is presented.
Proof: See Appendix H. The transition probabilities of X n are given in Lemma 9, where for notational convenience, define which is the transition probability from state (S n = i, L n = l, G n = c) to state (S n+1 = j, L n+1 = m, G n+1 = d). Lemma 9: The transition probabilities of the DTMC X n = (S n , L n , G n ) are as given in (30), as shown at the bottom of this page, where represent the probability of the arrival of d (e) data (energy) packets in a frame.
Proof: See Appendix I. In deriving the transition probabilities of the 3D DTMC X n , the states in X n are mapped into to a corresponding 1D chain to solve the stationary equations, and obtain the steady-state probabilities. The function g = 2c(L max + 1) + 2l + i + 1 maps each state (i, l, c) into a unique state, for i ∈ {0, 1}, l ∈ {0, 1, . . . , L max }, and c ∈ {0, 1, 2, . . .}. Denoting the transition probability matrix of the 1D chain by , each of its elements is calculated as where i = (r − 1) mod 2, and j = (s − 1) mod 2, while and Letting be a vector containing steady-state probabilities, and solving the stationary set of equations, while considering the normalizing condition in steady-state (i.e., = and 1 = 1), the probabilities π L (m) can then be calculated as where (·) refers to the corresponding element in vector . Remark 6: To avoid matrix singularity, the 3D DTMC matrix is changed into a block upper Hessenberg form, and then the matrix analytical approaches discussed in [75] are adopted. 13

IV. NUMERICAL RESULTS
In this section, the analytical derivations are evaluated, and the effect of the number of packets N per frame, sensing time T s and transmission diversity N rep on GoodPut, Availability, Reliability and network stability are investigated. Table 2 summarizes the simulated network parameters [27], [76]. 14 Fig. 2 illustrates the IoT network GoodPut as a function of the number of packets N in a frame, for N rep = 1 and T s = 2 ms. As can be seen, the GoodPut increases as N increases, and peaks at N = 7. Then, it starts to decrease gradually as N increases. This happens because for frames with few packets (i.e. N < 7), the portion of a frame that is allocated for data transmission (i.e. T tr ) is comparable to the sensing time T s . Therefore, the number of transmitted bits per transmission cycle is low, and thus, increasing N will lead to higher GoodPut. However, for N > 7, the GoodPut decreases due to the following two reasons. Firstly, the PUreturn interference increases with the increase in the transmission duration. Secondly, increasing N will increase the transmission cycle significantly, since there is higher possibility of false-alarms of spectrum opportunities, and hence, the successful and effective (non-repeated) transmitted bits diminish compared to the whole duration of the transmission cycle. To justify this, Fig. 3 is plotted to show that how the  expected value of transmission cycle increases by the increase in N . Fig. 4 presents the IoT network reliability, and availability in terms of the number of packets per frame. Evidently, the reliability decreases when N increases since the possibility of interference due to PU-return increases when the transmission duration increases. On the other hand, the network availability decreases as N increases. This is because with the increase in N , the expected value of the transmission cycle increases significantly as well as the corresponding energy consumption. This is also attributed to the fact that for each false-alarm occurrence, the IoT node-having longer frame duration-has to wait for longer time (longer frame), and hence, misses more energy (due to circuitry power consumption) of its battery compared to shorter frames. Note that although more energy is harvested during longer frames, no data transmission takes place during waiting except energy VOLUME 8, 2020  consumption. To see this, the average available energy of the IoT node's battery is shown in Fig. 5, where it is clear that the average battery energy decreases with the increase in N . Note that the highest reliability (slightly above 99% which is the case for URC) is achieved for N = 1, and it decreases as N increases. Since, Fig. 4 is obtained for N rep = 1, adopting transmission diversity-as will be discussed in subsection IV-C-can further help improve the reliability. Fig. 6 illustrates the IoT network stability measure ρ as a function of the number of packets per frame. It is observed that the higher the value of N is, the greater the ρ and hence, the more unstable the IoT network. In agreement with the observation made for ρ, Fig. 7 shows the average number of the packets in the IoT node's buffer (i.e. E[D]), which verifies that the number of the packets awaiting transmission rises when the transmission duration increases. This is because the higher N is, the greater the average transmission cycle, and consequently, the greater the waiting time resulting from sensing inaccuracy, and hence, more packets are queued in the buffer.   In Fig. 9, the GoodPut is plotted as function of sensing time T s , for N rep = 1 and N = 10. As can be observed, 15 For low values of sensing time, η GP is also low, since the spectrum sensing is inaccurate, and the IoT node misses most transmission opportunities. Moreover, increasing the sensing time leads to higher sensing accuracy, and thus improves the GoodPut. However, excessively increasing the sensing duration lowers η GP . This is because the excessive increase  in the sensing duration does not greatly improve the sensing performance, and also reduces the transmission time portion of the whole frame. Availability and reliability of the IoT network as a function of sensing time are drawn in Fig. 10. It is observed that the reliability improves sharply, and then saturates with the increase in the sensing time. This is because the sensing performance improves by increasing the sensing duration. However, for network availability, it starts to improve, peaks at T s ≈ 2 ms, and then decreases with the excessive increase in T s . To justify, note that the network availability is affected by channel availability, sensing accuracy, and energy availability, as defined in (28). Particularly, when sensing time in low, the sensing performance is low as well, and hence P NA is affected by the low sensing performance. For sensing times greater than 2 ms, higher energy consumption takes places, and hence, the lower the energy availability of the IoT node as depicted in Fig. 11. In other words, higher sensing times consume more energy, and thus the average battery energy decreases, ultimately reducing network availability. The IoT network stability measure ρ and the average number of packets in the buffer E[D] based on sensing duration are shown in Fig. 12 and Fig. 13, respectively. Clearly, VOLUME 8, 2020 both ρ and E[D] start to decrease with the increase in T s , and reach their minimum values for T s ≈ 0.3 ms. This is because with the increase in T s , the sensing accuracy improves (i.e. less missed transmission opportunities), which improves network stability and reduces the number of packets in the buffer. However, for T s > 0.3 ms, the values of ρ and E[D] start to increase dramatically. As discussed earlier, the excessive increase in T s does not drastically improve the sensing performance, and more importantly, leaves less time for data transmission in a transmission cycle, which leads to less stability, and higher average number of packets in the buffer. Fig. 14 depicts the collision probability versus T s . Clearly, higher sensing times yield less probability of collision. This is because the longer the sensing duration is, the more accurate the sensing result will be. Hence, the possibility of miss-detection by the IoT node decreases, and thus, the collision probability of the IoT node decreases by increasing T s .  Table 2. For the dynamic PU, λ 0 = 1 s −1 and λ 1 = 3 s −1 (i.e. idle and busy rates are set to higher values while keeping their ratio fixed). For the non-dynamic PU case, it can be observed that the GoodPut decreases with the increase in N rep . This is because the higher the number of transmitted frame replicas is, the longer the transmission cycle, and hence, the lower the number of effective information bits transmitted per time unit. Surprisingly, for PU with dynamic traffic behavior, η GP peaks when N rep = 2, and then decreases with the increase in N rep . This is because the interference due to PU-return is much higher in co-existence with the dynamic PU than that with the non-dynamic PU. Thus, the average number of successfully transmitted bits increases dramatically when a typical frame is re-transmitted, as such increase in the number of successfully transmitted bits outweighs the increase in the transmission cycle. Lastly, it can be seen that GoodPut in the non-dynamic PU case is always higher than that with the dynamic PU, and this is linked to the more corrupted information bits due to PU-return interference in dynamic case compared to non-dynamic one. Fig. 16 illustrates the IoT network reliability and availability in terms of N rep . As can be seen, the reliability increases sharply by employing transmission diversity for both dynamic and non-dynamic PU cases. To have an UR-EH-CR-IoT network with 99.999% reliability requirement, and comply with the 3GPP and ITU specifications [53], [77], N rep = 3 and N rep = 4 are needed for nondynamic and dynamic PU cases, respectively. On the other hand, the network availability decreases when N rep increases. This is possibly because more energy resources are consumed when several replicas of a typical frame are transmitted and hence, the average available battery energy reduces, which in turn reduces network availability. To see this, the  average available battery energy as a function of N rep is plotted in Fig. 17, where it is observed that available battery energy decreases as more replicas are transmitted. Finally, one can see a trade-off between reliability and availability in Fig. 16, where as reliability increases with the increase in number of re-transmissions, the network availability experiences an opposite trend. Notably, the availability is the same for both cases, which is explained by noting that the dynamic PU traffic does not affect the network availability of IoT nodes, since the energy consumption does not alter when coexisting with dynamic PU. Moreover, the percentage of time at which the channel is idle (i.e. π 0 ) remains unchanged in the dynamic and non-dynamic PU cases. Therefore, it is expected that the network availability to be the same for both cases.

A. EFFECT OF NUMBER OF PACKETS N N N Per Frame
The IoT network stability measure ρ and the average number of packets in the buffer E[D] as a function of N rep are depicted in Figs. 18 and 19, respectively. It can be seen that both curves rise up when N rep increases. This is due to the fact that by employing transmission diversity, lower effective (non-repeated) packets are transmitted per time unit, and hence, more packets await transmission in the buffer, which also worsens the network stability.  Remark 7: It should be noted that the collision probability is not dependent on N rep , as can be inferred from (12). Therefore, it remains unchanged for different values of N rep , and hence is not shown here.

D. VALIDATION OF ANALYTICAL DERIVATIONS
To validate the analytical derivations presented in Section III, a discrete event simulation (DES) is performed. To this aim, all independent network events-including the PU events, and IoT node's packet and energy arrival events-as well as all events related to the transmission impairments-including channel failure and spectrum sensing error-are scheduled. Each event time is sampled based on its statistic defined in Section II. The simulation time starts from zero and with initial states (i.e. empty buffer, zero level of energy for battery, and no PU presence in the channel). Then, the simulation time proceeds to the next nearest scheduled event, while the next time instant for the corresponding event is generated. All the network metrics are then calculated and updated. Note that all the arriving and departing data packets have to be timestamped in order to calculate the temporal metrics, such as  Furthermore, the root mean square error (RMSE) between simulation and theoretical results for GoodPut, network availability, and reliability for three different simulation times, 1 × 10 4 , 4 × 10 4 and 7 × 10 4 seconds are plotted in Figs. 24, 25 and 26, respectively. The curves show that by increasing the simulation time from 1×10 4 seconds to 7×10 4 seconds, the RMSE between the simulation and theoretical results is drastically decreased.
To summarize, the following trade-offs can be stated for the analyzed and simulated IoT network metrics. The GoodPut   is affected significantly by the IoT network parameters N , N rep and T s . In general, it experiences a peak by varying the aforementioned parameters. Therefore, it is necessary to  find the optimal combination of parameter values to achieve the maximum GoodPut. On the other hand, to achieve a target reliability, T s and N rep must be increased. However, excessively increasing the sensing time will lower the network availability. Hence, sensibly setting the sensing time (neither too short nor too long) helps both the availability and reliability to improve. This trend for the sensing time similarly affects the IoT network stability, where stability may be threatened with too short and too long values of T s (i.e. a trade-off between P NA , P R and ρ with respect to T s ). On the other hand, although increasing N rep results in reliability improvement, it lowers network availability, and also threatens network stability, which is also trade-off between P NA , P R and ρ, but with respect to N rep . Another trade-off is the increase in N , which reduces P NA and P R , and potentially makes the IoT buffer unstable. However, a network designer may decide to choose the lowest possible value of N (i.e. N = 1), which may not the appropriate choice, since the GoodPut is low for such value. Hence, by carefully selecting the IoT network parameters, η GP can be maximized, while simultaneously keeping P NA and P R and ρ within their target limits.

V. GOODPUT MAXIMIZATION OF IoT NETWORK
The obtained analytical derivations can be utilized to optimize the GoodPut of the IoT network, subject to constraints on the collision probability, reliability, availability and stability. Particularly, the optimization problem is formulated as where (34b) is the objective function. Constraint (34c) ensures that minimum network availability δ NA th is satisfied, while Constraint (34d) is the reliability requirement, which is at least δ R th . Constraint (34e) ensures the IoT network stability, while Constraint (34f) ensures that P coll does not exceed δ coll th . Constraint (34g) ensures that the sum of the sensing time and transmission time (where T f = NT P ) equals the total frame duration, whereas Constraint (34h) defines the probability of false-alarm, as given in (1), which also relates to P m and T s . The last three constraints define the range of values the decision variables take.
Remark 8: Problem GoodPut-Max is classified as a mixed-integer non-linear programming (MINLP) problem, which is non-convex and NP-hard [78]. This can be verified from the derived non-linear expressions of η GP , P NA , P R , ρ, P coll , and P f , and the integer-valued decision variables N and N rep . In other words, problem GoodPut-Max is computationally-intensive. Nevertheless, due to the steadystate analysis, the computational delay due to the solution of problem GoodPut-Max becomes irrelevant. 16 16 In this work, problem GoodPut-Max is solved via the global optimization package MIDACO [79], [80], with tolerance set to 10 −4 , which implies that the optimal solution is accurate up to four decimal places.   δ R th = 0.99999, δ NA th = 0.6, T p = 2 ms and T f = 20 ms. 17 Particularly, the optimal value of η GP is obtained in less than 15 iterations, and hence, the optimal solution can be computed efficiently. Fig. 28 illustrates the GoodPut as a function of N and N rep , where it is evident that the optimal value of η GP is achieved when N = 8 and N rep = 3. Note that N = 8 implies that T s = 4 ms since T f = 20 ms. Furthermore, in Fig. 28, the feasible constraints region is plotted in green in the (N , N rep ) plane to verify the solution. In the green region, constraints (34c), (34d), (34e), and (34f) are satisfied. To obtain this region, a new metric, called Figure of Constraint (FoC), has been defined as 17 The collision probability threshold is usually set to be less than 10% [27]. Moreover, T f = 20 ms is a typical value for the frame duration in many applications, such as IEEE802.16 [81], [82].
The feasible constraints region is then plotted in green when FoC = 4, i.e., when all the four constraints hold true. It is black for other values of FoC.

A. APPLICATION TO 5G-IoT NETWORKS
This study can be extended to 5G UR/URLL EH-CR-IoT networks. The frame structure-called transmission time interval (TTI) in 5G communications-should be revised, so that it encompasses several sensing sub-phases, each for sensing a single sub-channel. The remaining part of the frame, should be allocated to the transmission phase, which must include several resource blocks (RBs) [19], [83]- [85]. Both ARQ and diversity transmission strategies can be applied to achieve the target reliability. For an ARQ approach, another phase, namely the acknowledgment phase, should be appended to the end of frame. For diversity transmission, the aforementioned frames should be sent multiple times. A potential tradeoff manifests itself between the number of RBs and the order of transmission diversity. The former plays a role in reducing the packet latency, while the latter serves to improve the reliability. By exploiting the phase type distribution, one can formulate the network metrics considering dataand energy-causality. Furthermore, interested researchers can incorporate non-orthogonal multiple access (NOMA) into the presented system model [86], [87], ultimately suggesting a trilateral tradeoff between transmission power of user equipments, number of RBs, and transmission diversity. This is an interesting research direction, which is left for future work.

B. EFFECT OF IoT MOBILITY ON NETWORK METRICS
It should be noted that increasing the relative speed between the PU and the IoT node results in time-selective channel fading, which degrades both the transceiver link and the spectrum sensing performance, and in turn, increases the bit error rate probability P BER at the IoT receiver as well as the probabilities of false-alarm P f and miss-detection P m [58], [88], [89]. To see this, it can be inferred from (8) and (10) that IoT mobility may severely degrade the packet reliability, which is due to the increase in P m and P BER , ultimately (and intuitively) requiring more packet replicas N rep to be transmitted to improve P R . Also, from (28), one can infer that the network availability would also be degraded, since the increase in P f would lower spectrum availability due to IoT mobility. Hence, less spectrum opportunities are exploited by the IoT node transmitter. Furthermore, from (8) and (9), it can be inferred that IoT mobility would degrade the GoodPut η GP in the IoT network, since the successfully transferred number of bits by the IoT node is reduced due to the decrease in P succ (i, N rep ). However, the average number of packets in the IoT buffer, and hence the network stability are unaffected, since they depend on P F i , which is not affected by IoT mobility. To gain a complete understanding of the effect of IoT mobility on the network metrics, changes to the network model, assumptions and derivations must take place, 18 which entails a paper on its own to give it justice. Hence, it is deferred to future work.

C. EFFECT OF IoT JAMMING AND PRIMARY USER EMULATION ON NETWORK METRICS
To shed light on the effect of primary user emulation (PUE) and jamming on the network metrics, it should be noted that the reliability decreases with such attacks, because the imposed interfering power on the link exacerbates its quality and the bit error rate probability P BER . Availability is also reduced upon jamming or PUE presence, since the IoT node finds less spectrum opportunities. Therefore, availability decreases due to the reduction in spectrum availability, as can be inferred from (28). Moreover, in the presence of jamming and PUE, the IoT buffer tends to be less stable, since the IoT observes the channel less idle, and hence finds less spectrum opportunities. Thus, it has to wait longer (i.e. for more slots) to find idle frame, and hence, the packet transmission cycle increases, ultimately threatening the stability. Furthermore, increasing the packet transmission cycle will decrease the GoodPut, according to (9) (i.e. the effective number of transferred bits in a time unit is reduced). To resolve such attacks, some studies proposed improved spectrum sensing and detection techniques, which can be adopted by the IoT node [93]- [97]. However, such jamming/PUE detectors impose extra complexity to the network structure and operation.

VII. CONCLUSIONS
This paper has considered UR-EH-CR-IoT networks, where IoT network performance metrics such as GoodPut, reliability, collision probability, availability, and stability have been analyzed. Trade-offs in derived metrics in terms of different values for transmission diversity, number of packets per frame, and sensing duration have been investigated. Additionally, a new metric for network availability has been defined based on the energy availability and spectrum accessibility for UR-EH-CR-IoT Networks. The effect of sensing duration has also been examined, based on the interference due to sensing inaccuracy and PU-returns. Furthermore, the distribution of frame transmission time considering energy arrival and energy consumption profile as well as the dynamic spectrum access issues has been obtained, and through which the expected number of packets in the IoT node's buffer has been extracted and explored. It has been demonstrated that the GoodPut experiences a peak by varying the aforementioned IoT network parameters. On the other hand, to achieve a target reliability, sensing duration, and the number of replicas must be increased. However, excessive increase in the sensing time will lower the network availability. Hence, the sensing time 18 Note that many studies have considered cooperative spectrum sensing (CSS) [89]- [91] or proposed enhanced sensing techniques [88], [92] to overcome the effect of mobility and improve sensing performance. Such strategies can be used when mobile IoT nodes are considered (e.g. in cognitive vehicular IoT networks). must be sensibly set (neither too short nor too long) so as to improve both the availability and reliability. This trend for the sensing time similarly affects the IoT network stability, where stability may be threatened with too short and too long values of sensing time. On the other hand, it has been shown that although increasing the number of replicas results in reliability improvement, it lowers network availability, and also threatens network stability. Specifically, the increase in number of packets per frame reduces availability and reliability, and potentially leading to unstable IoT buffer. Lastly, the derived expressions have been utilized to maximize the GoodPut, subject to various practical constraints. Particularly, by carefully selecting the IoT network parameters, the Good-Put can be maximized, while simultaneously keeping availability, reliability, and stability within their target limits.

APPENDIX A PROOF OF LEMMA 1
Proof: Recall that P succ (i, N rep ) is the probability that at least one among the N rep replicas of a frame of type i (i.e. F i ) is delivered successfully (without any interference). Hence, P succ (i, N rep ) is written as where P succ (i) is the probability that each copy of an underlying F i -type frame is not delivered successfully. Also, note that in deriving P succ (i), two error factors are considered; one is related to (physical) channel distortion, while the other is related to collisions. Thus, P succ (i) = 1 − P(no channel error and no collision) where P BER is the probability of bit error due to the channel conditions and transmission configurations. Furthermore, P c i is the probability that each copy of an underlying F i -type frame collides with the primary transmission during successive attempts for transmission. For notational convenience, the index i is eliminated from the following expressions. Now, note that in deriving P c , two kinds of interference must be considered. Precisely, a typical frame is transmitted and received successfully if the SU (or IoT node) does not miss-detect the PU, and the PU does not return to the spectrum during that transmission frame. By defining E c j as the event of IoT colliding with the PU in the next j th frame, and E w k as the event that IoT node waits in the k th frame (i.e. no spectrum opportunities found by IoT), then In deriving (A.3), it should be noted that if the IoT node succeeds to transmit its data in the next j th frame, then it must have waited in all previous frames. To formulate P(E c j ), note that two kinds of interference may happen; if the channel is idle and collision happens when the PU-returns to the spectrum during the IoT node's transmission; or when the channel is busy and collision happens by the IoT's transmission. Now, recall that S j ∈ {0, 1} is a random variable representing the channel state at the beginning of the next j th frame (for j ∈ {1, 2, . . .}), where S j = 0 indicates that the channel is idle, whereas S j = 1 indicates that the channel is busy. Therefore, where it should be noted that the probability that the PU returns to the spectrum during the frame of type F i (for i < N ) is determined as where T idle is a random variable denoting the duration of idle state in PU traffic model. Combining (A.5) and (A.4) yields (1−e −λ 0 iT p )π 0 +P m π 1 P f π 0 +(1−P m )π 1 (j−1) .
Also, by substituting (A.8) into (A.2), and then into (A.1), and using the geometric series formulae ∞ j=1 x j = x 1−x , for |x| < 1 [98], P succ (i, N rep ) can be shown to be P succ (i, N rep ) For the case i ≥ N , P succ (i, N rep ) = P succ (N , N rep ), since no more than N packets can be transmitted in a frame. Moreover, if there are no packets in the queue, no transmission happens, and hence, for i = 0, P succ (i, N rep ) = 0. Finally, (8) is obtained.

APPENDIX B PROOF OF LEMMA 2
Proof: Based on the definition of GoodPut, it can be derived as Since each data frame has a maximum payload of N packets, iB p bits can be transferred in a frame, at the beginning of which i data packets exist in the buffer (with i < N ), and NB p bits if there exist at least N data packets in the IoT's buffer. Thus, η GP is determined as given in (B.2), as shown at the bottom of this page, where P succ (i, N rep ) = P succ (N , N rep ), for i ≥ N , according to Lemma 1. Moreover, ∞ i=N P F i is written as P N + according to definition of Frame N + . Furthermore, by taking the expectation of the time of transmitting all replicas of a frame (with PDF f rep S (t)), the expected value of transmission cycle can be obtained as [72], as described in Remark 4, and this completes the proof.

APPENDIX C PROOF OF LEMMA 3
Proof: First of all, recall that the reliability of type F i frame (for i = 1, 2, . . .) is the probability that it is delivered successfully at the IoT receiver. Moreover, this metric is defined over all non-empty frames (i.e. frames with at least one packet to transmit), and thus P F i must be normalized with respect to the probability of no empty frame (i.e. P F i /(1 − P F 0 ). Now, P R is obtained by averaging over all the frames within which transmission occurs, as where P F 0 is the probability that a frame is empty, and this completes the proof.

APPENDIX D PROOF OF LEMMA 4
Proof: Note that the interference occurs in two cases: 1) when the channel is busy and the IoT node miss-detects the PU's presence, or 2) when the channel is idle and the IoT node starts transmitting but the PU returns to spectrum. In the former case-which happens with probability of (1 − P F 0 )π 1 P m in steady-state-the whole frame is considered as interference time T tr . For the latter case-which happens with probability of (1 − P F 0 )π 0 (1 − P f ) in steady-state-the expected amount of interference time is denoted as I 0 (T tr ), which is given by [60], [71] Therefore, E [T int ] can be obtained as Moreover, the total transmission time in the two cases is T tr , and thus E [T tr ] = T tr 1 − P f π 0 + T tr P m π 1 . Hence, P coll is obtained as the ratio of E [T int ] to E [T tr ].

APPENDIX E PROOF OF LEMMA 5
Proof: To derive the transition probabilities, the states in Fig. 1 are classified according to the following eight cases. Particularly, Cases 1 and 2 pertain to the states when the battery energy level is lower than the minimum level for transmission, and vice versa for Cases 3-6. As for Cases 7 and 8, they are based the transitions from state ST to (j, m), and (i, l) to ET , respectively. Case 1 (l < tr , m < L max :) In this case, no sensing or data transmission occur due to lack of enough energy. Hence, transition from such states to states with higher energy level is possible, and the corresponding probability depends on the number of energy packets harvested. Noting that the channel state is independent of the energy arrival process, then (j,m) Since there is not enough energy for sensing and transmission, no energy is consumed, and hence, the energy level of the battery cannot be reduced to lower levels in the next transitions. Therefore, the indicator I(m − l) is used.
Case 2 (l < tr , m = L max ): Noting that the maximum battery level is L max , then those transitions that move from the state (i, l) to states with energy level higher than L max must be directed to (j, L max ). Then, for the case when l < tr and m = L max , Case 3 (l ≥ tr , i = 0, m < L max ): When the battery has at least the minimum level of energy for spectrum sensing and data transmission, and the channel is idle, the IoT node may either false-alarm it, or transmit its data packet. If the IoT node false-alarms and waits for the next frame, it consumes w energy levels of the battery, and should gain m − l + tr energy levels to move to the state with the target battery energy level of L n+1 = m. Note that the case when the IoT node does not false-alarm the channel should not be considered in this transition, since data is still transmitted in such scenario. 19 Noting that the state of the channel and the battery energy level are independent, then (j,m) Case 4 (l ≥ tr , i = 0, m = L max ): According to derivation in Case 3 and explanation in Case 2, when the battery has minimum level of energy for spectrum sensing and data transmission, the channel is idle and the battery energy level for the next state is L max . Thus,

(E.4)
Case 5 (l ≥ tr , i = 1, m < L max ): Transition probabilities in this case are similar to Case 3 with the difference that the channel is assumed busy, and the probability that the IoT node does not miss-detect (and does not transmit data) is 1 − P m . Therefore, (E.5) Case 6 (l ≥ tr , i = 1, m = L max ): Transition probabilities in this case are similar to Case 4, but with the channel 19 Note that an additional transition from all states to state ET is considered and discussed in Case 8. VOLUME 8, 2020 assumed to be busy. Hence, (E.6) Case 7 (Transition from the state ST to (j, m)): When a typical frame is ready to transmit, it virtually enters the state (S n = j, L n = m) with the probability (j,m) ST = π j π L (m). Case 8 (Transition from the state (i, l) to ET ): This transition relates to the end of transmission. Therefore, if l < tr , then no transmission happens and hence, this probability equals zero. Contrarily, for l ≥ tr , if i = 0, then such case happens with the probability of 1 − P f ; otherwise, P m is the corresponding probability.

APPENDIX F PROOF OF LEMMA 6
Proof: Define a random variable n ∈ {0, 1, 2, . . .}, representing the number of data packets in the buffer just after the n th frame's departure. Also, let A n ∈ {0, 1, 2, . . .} be a random variable resembling the number of arriving packets during the n th frame's transmission time. Then, which can be compactly written as Since the arrival process is time-homogeneous and independent of the transmission process, A n is not dependent on the frame number or departure instants. Hence, (F.1) resembles a discrete-time Markov chain embedded at the points of data departures, and thus, the steady-state probabilities P F i can be derived by solving stationary equations. By considering (F.2) and denoting h i as the probability of the arrival of i data packets in a frame transmission time, then . . .
To solve such set of recursive equations, the z−operator is exploited [68]. Particularly, let H (z) ∞ i=0 h i z i , and P F (z) ∞ i=0 P F i z i . Then, by multiplying each of the above equations by the appropriate power of z and summing all of them, P F (z) is obtained as P F (z) = P F 0 H (z) + · · · + P F N −1 H (z) which can be simplified as .
Since h i is defined as the probability of i data packets arriving during a frame transmission time, then it is evaluated as Note that if P F i (for i = 0, . . . , N − 1) are known, then P F (z) in (F.6) will be completely known, and other metrics can be derived, such as the network stability measure ρ, and the expected number of packets in the buffer E [D]. Specifically, under the stability assumption, P F (z) in (F.6) must not have any poles. Using Rouché theorem [74], and the fact that the arrival process is memoryless, the denominator of (F.6) (i.e. z N − H (z)) has N distinct zeros, and these zeros must be canceled by the zeros of the numerator. One can also check that z = 1 is one of the N denominator zeros, since H (1) = 1. In turn, let the zeros of the denominator be denoted by z l (for l = 1, . . . , N ). Then, all the P F i (for i = 0, . . . , N − 1) can be determined by solving the zero-pole-cancellation set of equations given by It can be deduced from (F.9) that H (z) has no zeros, since it is the sum of positively weighted exponential functions, and hence, H (z l ) in (F.8.2) can be removed. Finally, by using L'Hospital's rule [98], the equations set to obtain the unknown P F i is To obtain the probabilities P F i , for i ≥ N , refer to the set of equations (F.3). Then, one can obtain

APPENDIX G PROOF OF LEMMA 7
Proof: To derive the stability measure ρ, let N arr and N tr be the numbers of packet arrivals and transmitted packets during a frame transmission cycle T cycle , respectively. Then, ρ is determined as the ratio of E [N arr ] to E [N tr ]. Now, recall that data packet arrival process is Poisson with rate λ d , and the PDF of the transmission time is defined by Remark 3, then according to the definition of h i in (F.7), E [N arr ] can be obtained as Hence, the stability measure of IoT network is obtained as The expected number of data packets in the IoT's buffer can be obtained by the property of z-operator as [68], where P F (z) is given in (F.6). Now, to obtain E[D], the expressions for d dz H (z) | z=1 and d 2 dz 2 H (z) | z=1 must be derived. The first term equals the expected number of arrival packets during a frame transmission cycle E [N arr ], as given in (G.1). On the other hand, the second term can be derived as By using the geometric series and noting that in (25) is obtained.

APPENDIX H PROOF OF LEMMA 8
Proof: To prove that X n = (S n , L n , G n ) is a DTMC, consider the probability P(X n+1 | X n , X n−1 , . . . , X 0 ). Because the channel state at the beginning of the (n + 1) th frame is only dependent on that in the previous frame, and the number of data packets in the buffer as well as the energy level at the beginning of the (n + 1) th frame are independent of the channel state at that frame, then P(X n+1 | X n , X n−1 , . . . , X 0 ) is obtained as given in (H.1), as shown at the bottom of the next page, where L n+1 and G n+1 can respectively be written as and G n+1 = min(0, G n − G t n + G a n ).
Moreover, L c n and L h n are the consumed and harvested energy during the n th frame, respectively. Also, G t n and G a n are the transmitted and arrived data packets during the n th frame. Moreover, L h n is assumed to be i.i.d for all frames, and hence is not dependent on n. In fact, L c n is only dependent on L n , S n and G n , and thus can be written as given in (H.4), as shown at the bottom of the next page.
By considering (H.2) and (H.4), it is concluded that P(L n+1 | G n+1 , X n , . . . , X 0 ) is only dependent on X n , i.e., P(L n+1 | G n+1 , X n , . . . , X 0 ) = P(L n+1 | X n ). The same argument holds true for G n+1 , in which G a n is assumed to be a homogeneous Poisson process, and thus is independent of n. Also G t n is only dependent on L n , S n and G n , and thus is written as given in (H. 5), as shown at the bottom of the next page. By considering (H.3) and (H.5), it is concluded that P(G n+1 | X n , . . . , X 0 ) is only dependent on X n , i.e., P(G n+1 | X n , . . . , X 0 ) = P(G n+1 | X n ). Thus, P(X n+1 | X n , X n−1 , . . . , X 0 ) = P(X n+1 | X n ), (H. 6) and this proves that X n is a DTMC.

APPENDIX I PROOF OF LEMMA 9
Proof: To derive the transition probabilities of X n = (S n , L n , G n ), the states are classified into different cases based on the channel state, energy battery level, and number of backlogged data packets in the buffer.
If there is no data packet in the buffer, no sensing and transmission will occur. Therefore, the energy level of the next state, and the number of backlogged data packets cannot be less than those of the current state. Hence, by noting that the channel state is independent of energy and data arrival processes, then ϒ

(I.2)
Note that since there is no energy consumption or data transmission, the probability of making a transition from a state with c = 0 packets in the buffer, and l energy level to states with d backlogged data, and m energy levels is equivalent to the probability of the arrival of d data packets (i.e. P pkt D (d)) and the harvesting of (m−l) ε ξ energy packets (i.e. P pkt E (m − l) ε ξ ). Since the packet arrival process is assumed to be a homogeneous Poisson process with rate λ d , then in (I.2), P pkt Case 2 (c = 0, m = L max ): This case is similar to Case 1, but with the difference in that the battery level in the next state is saturated. Hence, in the formulation, the transitions from state (i, l) to the states with energy level higher than L max (i.e. (j, L max )) must be summed. Thus, by adopting the same derivation in Case 1, then where I(d − c) and I(m − l) indicate that the number of backlogged data packets, and the energy level of the battery in the next states cannot be lower than those in the current state, respectively.
P(X n+1 | X n , X n−1 , . . . , X 0 ) = P(S n+1 = j, L n+1 , G n+1 | X n , . . . , X 0 ) = P(L n+1 , G n+1 | S n+1 = j, X n , . . . , X 0 )P(S n+1 = j | X n , . . . , X 0 ) = P(L n+1 , G n+1 | X n , . . . , X 0 )P(S n+1 = j | S n = i) = P(L n+1 | G n+1 , X n , . . . , X 0 )P(G n+1 | X n , . . . , X 0 )P i,j (T f ) (H.1) if L n < tr or G n = 0, tr , if L n ≥ tr , G n = 0, S n = 0, no false-alarm, tr , if L n ≥ tr , G n = 0, S n = 1, miss-detection, w , if L n ≥ tr , G n = 0, S n = 1, no miss-detection, w , if L n ≥ tr , G n = 0, S n = 0, false-alarm (H.4) if L n < tr or G n = 0, min(G n , N ), if L n ≥ tr , S n = 0, no false-alarm, min(G n , N ), if L n ≥ tr , G n = 0, S n = 1, miss-detection, 0, if L n ≥ tr , G n = 0, S n = 1, no miss-detection, 0, if L n ≥ tr , G n = 0, S n = 0, false-alarm (I.5) Case 5 (l ≥ tr , c = 0, i = 0, m < L max ): In these transitions, the IoT node may send its data, or false-alarms and waits for the next frame. Then, ϒ (j,m,c) (i,l,d) is obtained as given in (I. 6), as shown at the top of this page. For the case of transmission, since the IoT node can transmit the maximum of N data packets in a frame, the total number of transmitted data packets is min(c, N ). The transition from states with c backlogged data packets to d backlogged data packets is equivalent to the arrival of d − c + min(c, N ) data packets. Moreover, transitions from states with l levels of energy to states with m levels of energy is equivalent to harvesting P pkt E (m−l+ tr )ε ξ energy packets. On the other hand, if the IoT node false-alarms and waits, the aforementioned transition is equivalent to the arrival of d − c data packets (since no data is removed from the buffer), and the harvesting of P pkt E (m−l+ w )ε ξ energy packets. Hence, P(G n+1 = VOLUME 8, 2020 d, L n+1 = m | S n = 0, L n = l, G n = c) in (I.6) can be obtained as given in (I. 7), as shown at the top of the previous page, in which E tr is the event that indicates data transmission by the IoT node, and E w is the event indicating that the IoT node false-alarms and waits for the next frame. Moreover, P(G n+1 = d, L n+1 = m | S n = 0, L n = l, G n = c) is determined as given in (I.8). Finally, by substituting (I. 8), as shown at the top of the previous page, into (I.6), ϒ (j,m,c) (i,l,d) is obtained as given in (I.9), as shown at the top of the previous page.
Case 6 (l ≥ tr , c = 0, i = 0, m = L max ): This case is similar to Case 5, but with the saturated energy level for the next state. By summing over all states with battery energy levels higher than L max , ϒ (j,m,c) (i,l,d) is determined as given in (I. 10), as shown at the top of the previous page.
Case 7 (l ≥ tr , c = 0, i = 1, m < L max ): In these transitions, the IoT node may wait for the next frame, or missdetects and sends its data. Following the same procedure in Case 3, and considering that the channel state is busy in the current state, ϒ