# Device Centric Throughput and QoS Optimization for IoTsin a Smart Building Using CRN-Techniques
## 2 System Model  
We consider a smart-building environment, which consists of a central entity, \(Q\) spectrum-sensors, \(I\) IoT devices, \(M\) mobile users and \(N\) free licensed channels. The central entity is responsible for spectrum-management, which includes the tasks of spectrum-sensing and spectrum-allocation. During spectrum allocation, the central entity allocates the available licensed channels to the IoT devices and mobile users. IoT devices and mobile users are considered to be SUs. However, they do not perform the task of spectrum-sensing because we employ dedicated sensors for the spectrum-sensing task. It not only helps to conserve the energy of IoT devices and mobile users, but also reduces the delay incurred in the spectrum-sensing process. First, the spectrum-sensors sense different channels to check whether they are empty or not and send their decisions to the central entity. Based on these decisions, the central entity decides finally whether a licensed channel is free or not. After spectrum sensing, the central entity performs the channel assignment to allocate the free channels to the IoT devices and mobile users. With reference to IoT devices, mobile users and networking monitors (NMs), we divided them into \(C\) classes. Each class has minimum requirements in terms of data rate (\(\alpha_{min}\)), bit error rate (\(\beta_{min}\)) and stability index (\(\gamma_{min}\)). A typical smart building with IoT devices, mobiles users and spectrum-sensors is shown in Figure 1.  
Since IoT involves energy-constrained devices, these cannot transmit over long distances; otherwise, their battery will drain out very quickly. Therefore, to facilitate their communication with the central entity, we divide the smart building into a number of sections. Each section has specific gateways. The communication between SUs and the central entity happens via gateways. The frame exchange sequence between the SUs, gateways and central entity is shown in Figure 2. A brief description of these frames is as follows. First, each SU that has data to send directs an I-REQ message to its respective gateway. The I-REQ message specifies the class of a particular SU. After receiving I-REQs from all SUs, the gateways forward C-REQ message to the central entity. The C-REQ message includes the information about the requirements of all SUs associated with a particular gateway. After receiving C-REQ messages from all gateways, the central entity maximizes the total number of served users while assuring the minimal QoS requirement of each SU according to its class. For channel allocation to an SU, the central entity considers the data rate, bit error rate and stability index of the channel, which are discussed in subsequent subsections. The central entity broadcasts the C-GRANTmessage towards each gateway, which contains the list of channels assigned to each SU. Then, each gateway directs I-GRANT messages to the respective SUs. I-GRANT contains the channel number that is allocated to each SU. If a PU comes back on any channel, a PU-DETECTmessage is generated by the central entity to gateways, which indicates the arrival of the PU on the scheduled channel. As a result, gateways generates CH-PAUSEmessage to SUs to halt their ongoing transmission to avoid interference with PUs. Table 1 depicts the important symbols and notations for better understanding of the proposed scheme.  
Figure 1: Proposed system model.  
Figure 2: Frame exchange sequence between SUs, gateways and the central entity.