SenPUI: Solutions for Sensing and Primary User Interference in Cognitive Radio Implementation of a Wireless Sensor Network

. After an introduction of cognitive radio (CR) technology in communication, the hot research topics are sensing, Primary User Interference (PUI), spectrum management, security, spectrum sharing, and environmental sensing. Among the listed, sensing and Primary User Interference are the bold ones. The base query for these two problems lays finding a means for which and what channel at a particular time is available and avoiding interference with Primary Users (PU). This article presents a novel cognitive radio algorithm called SenPUI for both mentioned main challenges, sensing and PUI. First,energy scan during the inactive portion of communication which is dynamic is done. Second, application packet based primary user identification for PUI avoidance is proposed as base solution. Both techniques described in this work are implemented and resulted in a significant reduction of the target problems estimated around 10-30% reduction in average. Main limitations of Wireless Sensor Network (WSN) such as memory, battery lifetime, and size are considered during the design and implementation of our solutions.


Introduction
The idea behind CR technology in a WSN is granting these small devices to make a decision defending in which they operate in a specific time and place to achieve end-to-end goals. The general goal of applying CR to WSN is to improve their performance by efficient use of available bandwidth and reduce interference (collisions). Even more, CR could facilitate a better way to provide Quality of Service (QoS) to WSNs applications and longtime battery.
With the unique characteristics and emerging challenges of real-time use of sensors in Cogitative Radio Wireless Sensor Network, CRWSN is far beyond the scope of CR itself, i.e., yet not designed with the consideration of real-time communication with respect to Non-Orthogonal Multiple Access (NOMA) which is growing as spectrally effective various access technique for the CR mobile networks, where increased users served at the same time-frequency but with different power levels [1]. Wireless communications usually consist of nonredundant data; for example, carried information is highly compressed. Therefore, providing endto-end congestion control acquires significance to satisfy real-time communication and high data rate delay-sensitive applications QoS requirements in CRWSN. CR should be aware of the amount of sensory data being communicated and know when and where to forward it. Here we indicate the real-time relationship between knowing free channels and using them. Also, a high level of knowledge about the type of environment they operate helps us to identify Primary Users (PU) using a packet type exchanged.
Most recently, NOMA has been proposed in numerous systems of cognitive radio implementation, that is, amplifyand-forward scheme for spectrum sharing in cognitive radio channels [2], convolutive superposition for multicarrier cognitive radio systems [3], power allocation for interference alignment [4], Cooperative Non-Orthogonal Multiple Access in Cognitive Radio [5], and Advances and Future Challenges in Non-Orthogonal Multiple Access [6].
Amplify-and-forward (AF) relaying scheme allows the SU (Secondary User) to amplify a signal of PU by some 2 Wireless Communications and Mobile Computing scaling factor and let the channel used be either active or inactive [1][2][3]. Hence SU is active in all the channels allocated for the Pus; then power consumption and related factors are significantly problematic. As well, even it is in a fraction of time, there is a delay for PU data while amplified by SU. Three-level power allocation is performed to maximize the throughput of SUs [4]. Such an algorithm can recommend if the PUs and SUs exact power consumption is known and measured depending on the surrounding conditions not only by considering the internal power level of communicating device. In contrast, SenPUI does not require an internal power level (PL); preferably it depends on the condition of the overall network operating environment. In [5], cooperative NOMA has been applied to underlay CR network and its performance based on the probabilities derived of the proposed cooperative scheme over noncooperative scheme under CRNOMA system. So far, the simulation result indicates in this work that cooperative NOMA is more efficient over the noncooperative implementation of cognitive radio. The fundamental effectiveness of any NOMA scheme is studied by analyzing its result in improving power/energy efficiency, complexity in professional implementation, interference, and power domain multiplexing [6]. So, that is why in our work sensing the available channels energy detection is employed by WSN coordinator during the inactive period of communication as described in [7]. The beacon-enabled IEEE 802.15.4, a superframe which consists of an active portion and an inactive part, starts at the beginning of a beacon frame and ends at the beginning of the next beacon frame. WSN PAN coordinator will scan licensed frequency spectra during the inactive time to find the free licensed channel for sensor nodes to be used in next superframe. WSN PAN coordinator scan allowed channels during the idle period to determine the available permitted channel for sensor nodes used in next superframe. Once a cognitive radio knows the type of information exchanged between users, it is easy to propose users as primary and secondary based on the type of data transferred. So, in SenPUI, a device is PU when it is planning to send data which is so essential.
Fundamentally, our hypothesis is that by implementing solutions for sensing and PU traffic identification in WSN it is likely to achieve QoS, long lifetime of the sensor, possible to search channel holes and allocate them on real time. To this end, we try to answer two major issues: (I) when to perform channel sensing to identify the free channel and (II) how to select a sensor as primary or secondary user depending on the type of packet exchanged (application packet-based classification).
Organization of the whole paper is as follows. In Section 2, we provide a brief overview of cognitive radio technology under related works. The general scenario is presented in Section 3. In Section 4, we explain sensing during the inactive period of communication. Then, we describe the main algorithm functionalities: algorithm design, application-based PU identification, channel selection, and channel notification mechanisms in Sections 5, 6, 7, and 8, respectively. Finally, we explain result analysis in Section 9 and conclude the paper in Section 10.

Related Work
Up to date, data traffic in many WSN based communications is dynamic because of the traffic modeling used and specific application designed for. So, during the implementation of cognition, two main issues are challenging: one is PU packet identification and the other is channel sensing and real-time usage of sensed results. To solve both mentioned problems, an increasing number of algorithms based on the Wireless Sensor Network cognitive radio have been proposed. In Evangelia Matskani et al. 's work [8] with the title "The Mutual Benefits of Primary-Secondary User Cooperation in Wireless Cognitive Networks by Increasing the Probability of Successful Packet Transmission for the PU," the SU essentially increases the service rate of the PU queue. However, such strategies work under the constraint that the interfering effect of the SU transmitters on the PU receivers must be known. In F. Verde et al. 's work [9], the overlay-based approaches for CRWSN allow the SUs to transmit through standard orthogonal methods. Later, such an approach is difficult to implement, due to the energy-and hardware-constraint nodes, for obtaining accurate and timely knowledge about the spectrum holes. But an overlap of SU transmissions with the PU signals in the frequency, time, and space domains relieves the burden of spectrum sensing. In IEEE Computer Society's work [10], the standard provides an option to use superframe structure in beacon-oriented communication and the superframe has the inactive part where it enters idle mode. So it is possible to use this time for energy detection and next communication channel notification. Leslie Choong [11] proposes several different approaches used for non-burst traffic communications for prediction of PU packet arrival in WSN communication. But nowadays it is known that sensors are everywhere, and traffic is highly burst. Liu, W. Gabran, P. Pawelczak, and D. Cabric [12] present a mathematical analysis of the accuracy of estimating PU's mean duty cycle u, as well as the mean off-and on-times, but the method considers the PU characteristics and sensing problem is not considered. To generalize this part almost similar methods are implemented in all references [13][14][15][16][17][18][19][20]. Nowadays, millions of sensors are entering the market and the world of sensor communication is getting more attention with its problems as explained in our previous work in Kedir et al. [21]. So, our recommendation is designing PU based on the application packet communicated. The advantage of using such way is that it is easy to implement in a real environment. This technique is used only if the very significant applications packet in the network is known and primarily set during initialization.
Regarding our contribution, unlike previous works, Sen-PUI focuses on developing a technique that can solve the two main problems of CRWSN together, sensing and PUI. In other words, this paper describes how to use an inactive time sensing strategy that has dynamic time length depending on the traffic of the network and addresses the compromises that exist between primary and secondary users. Since PU classification is based on the application packet to be sent, an MN can be PU when it plans to send PU-application packet and the same MN classified as SU when it transmits SU packet in a same operating area. Therefore, we propose a strategy Wireless Communications and Mobile Computing 3 called SePUI to solve two key issues for the application of CRWSN to maximize communication throughput and minimize interference: (I) sensing strategy during the inactive period of communication and (II) application-based PU-interference avoidance.

General Scenarios
Design considerations are formulated to bring and implement the most common manners of WSN application design assumptions in practice. Six crucial considerations throughout the entire implementation process are (I) beacon-enabled CRWSN, where whole licensed channels are assumed to have same channel gain, (II) sensing done by the WSN coordinator, (III) identification of PU data packet done by both sender and receiver, (IV) to have an effective outcome we considered a beacon-enabled network of one WSN coordinator and Nnumber of sensor nodes in a star topology, (V) selection as well as notification of the selected channel for next communication is the WSN coordinators function, and (VI) every time when a WSN coordinator receives a packet, it will check for current slot and if it is greater than or equal to the tenth slot, then execute sensing and notify the network which channel is used for next communication. Mobile nodes' (MN) main three functions are the following: (I) an MN that changes its communication parameter, the CurrentChannel, based on the notification received from a WSN coordinator during successful packet reception; (II) set up a flag for notifying a coordinator to identify the data to be sent is PUs application data or not; (III) the number of packets to transmit needs to be specified.
Basic general scenario case is shown in Figure 1 considering one coordinator and N-end devices. Hence end devices can be a primary user or secondary user, only depending on initial application set-up specified. Because identifying PUs depends on the particular application taking place at a specific time, this character makes end devices act dynamically based on the type of application and data they are going to exchange. In turn, this will have a big advantage for PU data traffic identification and make WSN coordinator alarmed when the packet reaches it. Furthermore, it is necessary to understand that when end device transmits its PU application packet that needs to attach a flag which indicates whether a packet is primary user data or not, that makes it easy for a coordinator to provide priority.

Sensing during Inactive Period of Communication
Sensing strategy over multiple channels for SUs is an essential issue that needs to be discussed in this modern technology, CRWSN. Considering the problem from a perspective of throughput and delay, energy consumption decides whether a secondary user (unlicensed user) can access the channel or not. If not considered in such manner perhaps different users assigned the same channel at the same time and led to packet loss and inefficient communication environment. In a beacon-enabled communication, the two main communication periods are active and inactive [10]. It has nothing to do with the active part which is for an information transfer; meanwhile inactive portion is a time where the device enters a low-power (sleep) mode, which gives us an opportunity to use this free period. In SenPUI, during the inactive portion of the communication, some special kind of sensing or energy detection and notification methods is introduced. The active period is most of the time equal to the superframe duration and the whole active and inactive period is equivalent to beacon order so as to to get the duration of inactive period directly subtracting superframe duration from beacon order. As seen below, from the standard IEEE Computer Society [10], active and inactive portion of communication seen in Figure 2 are calculated as follows: where SD is superframe duration, SO represents superframe order, BI denotes beacon interval, and BO is beacon order. So inactive portion (I) is as follows: From Figure 2, inactive portion is divided into N number of time slots, where all time slot intervals are divided equally, so every sensing time slot is represented by general formula: where Ts is time slot.
In Figure 3(b), we allowed ED-scan only when the superframe order is greater or equal to the tenth slot of beacon order. Every time before energy scan starts the algorithm, it sets scanned channel to zero, S . Each ED-scan result is stored in T and when S is higher than the value of BD, the inactive period of communication, automatically ED-scan stops and looks for whether current channel is a channel with the lowest energy level or not. If the response is positive, then it will assign the same channel for the device to use in its next communication which is done by sending a  notification message. In case we have channels with the equal energy level in our table, T , we have additional parameters to compare, the table of the channel used time, T . Here the last used idle channel is selected, because the shorter term of idle state kept may signify the longer duration of availability for the next superframe. The entire process ends by sending a notification message to the communicating mobile node deciding which channel to use for next communication, N .

SenPUI-Algorithm Design
In Figure 3, T is a table of energy detection result stored; N represents next channel selected from ED-scan results; number of PU-packets to be transmitted is represented by P ; the table of channel used time, T , is to select shortest idle time; current time slot is represented by C ; scanned channel counter is represented by S ; and BD is inactive portion of superframe.
SenPUI has two main parts, PU-interference avoidance shown in Figure 3(a) and ED-scan in Figure 3(b). It employs PU-application packet priority by granting session and order Energy Detection scan (ED-scan) in last time slots of the superframe to find channel hole as explained above in Section 4. From the transmitter node, the algorithm looks for the value of the flag, PU. If the state for PU is true, then the algorithm goes for number of PU-packets to be received (P ) in order to allocate enough time slot or session; after assigning a session, the proposed algorithm receives all PU-application data and checks whether any other PU application data is demanding for the corresponding channel. Hence, SenPUI algorithm can check every time the current time slot (C ) symbol; then it will direct ED-scan when C is higher than the tenth slot. Considering the EDscan performance, the algorithm divides the remaining time slot into equal N-number of time intervals, Ts, and performs ED-scan. While finishing ED-scan, WSN coordinator sends a notification to a communicating device deciding which channel is used for next communication. The responsibility that the MN has is to configure the parameters received from the coordinator accordingly, as well as flag attaching  and notifying the number of PU-applications during normal communication.

Application-Based PU Identification
Primary user interference minimization is a huge concern during the implementation of CR, expected to result in no or minimum interference with a primary user (PU), and yet it is a challenging problem. More importantly, not knowing when PUs claim for the channel is a significant challenge to be solved. In WSN applications, nowadays sensors are multifunctional: one sensor for many applications. In such circumstances, classifying users as PUs and SUs is not dependent on the sensor preferably; it must depend on the type of application embedded in the sensor. Because the traffic in WSN is very dependent upon the application packet scenario, only those chosen during initial setup as a primer user data traffic application are considered as PU. It is known that every data in communication is essential but hoping that we have some priority level of our communicating application data packet.
Clearly seen in Figure 3(a) is the fact that when the packet arrives, the first task of SenPUI algorithm is to check if it is PU data or not. If it is PU data, the number of packets to be transferred will be reviewed and allocated a session. By doing so, the current channel is granted for current MN. When the session expires, the current slot number is updated and based on the updated data notification beacon will be broadcasted. Also, if superframe duration is less than ten, it will continue communication without any energy scan.
In SenPUI, some communication parameters, superframe order, and beacon order are changing dynamically based on the number and payload of a packets to be received, which is managed by applying session during reception of packets.
Finally considering all factors, we agreed that the application taking place at that specific moment is the defining factor for a device to call it PU or SU. Application-based PU identification needs information about what kind of applications has a higher priority in the operating network. So, applications with higher preference must be set during initialization.

Channel Selection
While finishing sensing and result collection, the next step is to decide on the results. First, check if the current channel is idle or busy for the next communication. If the current channel is quiet or if it is with the lowest energy level from the list, it is recommended to utilize the same channel for the next communication. Otherwise, a new channel with shortest idle time is selected; the shorter idle time means the higher availability of the channel. The overall process is explained in detail in Figure 3(b), selection method.

Channel Notification
After each successful reception of packets from a device, it is the WSN coordinators responsibility to notify communicating device about the next channel to be used. The notification message consists of a channel to be used in the next communication. This message is generated and sent during the last time slot of the inactive portion of the communication. There is a list of mechanizations: (i) periodically broadcasting method and (ii) sending back a message for a particular device regarding changes by customizing superframe specification filed. Several experts in the area agree that the second technique, customizing superframe specification filed and sending back notification message, is recommended [7]. We too implemented this recommendation, because, compared to the first one, the time it takes to process is short and easy for channel management. Also, there is less chance of failure for various reasons. In this work, we own a simple and easy notification technique described as follows: from the standard IEEE Computer Society [10] superframe structure includes some reserved fields for such usage, reserved bit 13 ℎ used for notification of channel changes in SenPUI. Notification bit, bit 13 ℎ , is used to store a channel to be used for next communication, which is selected by its WSN coordinator. Receiving the notification message, the responsibility of end device (communicating device) is extracting the information and reconfiguring its communication parameter for CurrentChannel. By doing so, the device adapts changes in its surroundings. In Table 1 how to generate a simple notification message using reserved bits, bit 13 ℎ , is shown.

Result Analysis
Points to be considered during result collection are efficiency depending on the running application and the operating environment. Below we listed out how to analyze the overall network throughput under common environment but take in consideration the fact that these are not the only ways but rather the common once. is to bring the difference between scan and usage time to a minimum level. (3) For dynamic adaptability of end devices with changes from the coordinator side, since sensing is done from CN (coordinator) how and when to notify changes to the communicating end device are important. This analysis is measured depending on how long the process takes without interfering ongoing communication.
Real-time implementation is conducted for result verification of our approaches. We have a single hope beaconenabled WSN coordinator with dynamic inactive periods (BD) of the intervals 10 ℎ to 14 ℎ . SenPUI algorithm shown in Figure 3 is applied. Four channels are selected for analysis, 11, 12, 13, and 14. The numbers of PUs and SUs range from one to ten, all of them communicating with a full data rate of 250 kbps in the available licensed channel with its coordinator. Packet arrival rate is random between 0.4 and 1.5 seconds and for real-time results collected using software called Termite. Omnet4.6++ is used for simulation and result comparison is done for comparison with original standard, IEEE 802.15.4, and other works in the same application area.

PUI Comparison.
We try to figure out the system throughput of our technique with respect to interference. We vary the number of SU application packets from 0 to 10 and 5 different PU application packets are used in all communicating devices. As shown in Figure 4, in general, SenPUI has better system throughput than the standard IEEE 802.15.4 protocol, IEEE Computer Society [10].
Our technique uses application-based PU-identification other than the default transmission standard to send the data over, while the standard IEEE 802.15.2 protocol uses the default mechanism to send both PU-data and SU-data packets. Therefore, the IEEE 802.15.4 protocol suffers from a higher collision rate between data packets. On the other hand, SenPUI is able to manage traffic congestion by means of PUidentification rather than the default used by the standard. Therefore, with less collision rate, it achieves a better system throughput. In Figure 4 it is clear that in both, SenPUI and the standard results decrease while the number of PUs increases. Results are calculated based upon the average of  20 consecutive distinct values recorded in a different test environment.

PU Traffic Tracked.
We plotted the number of average packets received by the WSN coordinator in Figure 5. The primary user application packet tracked is the ratio between the number of received packets of primary user to the number of primary users in the network. Although at the beginning of the experiment the standard protocol, IEEE Computer Society [10], produces a much better data delivery ratio (i.e., higher than 90%), the value then drops drastically below 60% while increasing the number of PUs. On the other hand, SenPUI still achieves roughly above 70% which is way more than the standard. By implementing SenPUI, the results changed to more throughput. One to seven SUs were used during result collection and what we noticed is that outcomes vary with the type of application, the load of packets, operating environment, number of PUs and SUs, and internal device factors. So, the reader must remember that these results may vary for different applications in the same area. Also, it is known that analyzing in the real world is somewhat different compared to doing so in a simulation.  Table 2. Note that experiments are carried out with different application packets but, by full data rate of 250kbp, the related works may have had different test sets, as the objective of this work is to minimize interference by identifying PU-application and reduce the target problem to some extent.

Conclusion
Sharing channel for SU is remarkably important nowadays, with many new technologies emerging, and we have a limited number of free channels. Assuring the quality of PU in communication is also a crucial point. Various communication conditions need addressing when designing cognitive WSN, from implementation environment to the type of application.
In this paper, we present SenPUI as a solution for two major problems in cognitive radio implementation of WSN: sensing and PUI. This work gives readers information on (1) when to do channel sensing while communicating without interrupting ongoing communication, (2) how to use scan results, (3) the mechanism to notify changes for communicating device, and (4) application-based PU identification. Divide the inactive period of communication into N time slots and use N channel scans. After completion of an energy scan, results are checked, and the shortest idle channel is assigned for the next communication. 13 ℎ bit of superframe structure is used for notification of changes. The responsibility of end device is reconfiguring its CurrentChannel parameter during reception of the notification message. As seen in results part, the method grants efficient communication outcome with minimized PUI, which is the central goal of SenPUI.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that there are no potential conflicts of interest with respect to the research, authorship, or publication of this article.