A Trust Value-Based Spectrum Allocation Algorithm in CWSNs

With the increase of congestible frequency spectrums and the rapid development of wireless sensor networks (WSNs) applications, the new technology—combing cogitative radio technology with WSNs—called CWSNs will bring broad prospects to the field of radio and sensor networks. CWSN devotes itself to the solution of spectrum sharing in forms of networks, such as IEEE 802.11 and Bluetooth. A new algorithm is proposed for allocating the idle spectrum to secondary users (SUs). This algorithm uses “the last diminisher” algorithm, which appears in fair division models. It can help solve complicated problems in a simple fashion. This article combines the trust value and the method of spectrum allocation. The concept of trust value in reputation management is introduced. All the factors are applied to solve the realistic problems of spectrum allocation. With the growing number of sensor nodes, the stable throughput is of vital importance.


Introduction
With the global data congestion increasing by 50 percent per year, the wireless sensor networks (WSNs), one of the fastest growing wireless networks in recent years, are faced with network traffic as well. Tens of thousands of tiny sensor nodes are distributed in the wireless sensor networks to detect surrounding data. With the rapid development of the WSNs, this potential application scenario has gradually proceeded to reality, from industry to home to civilians as well as the military. New wireless communication techniques, such as ZigBee and 802.15.4, have already enabled the interoperability between products to ensure extendibility of the network and low consumption.
Most of the wireless sensor networks work in unauthorized frequency bands, such as ISM, which is a universal 2.4 G frequency band. This frequency band is shared by many popular technologies, such as Wi-Fi and Bluetooth. Therefore, with the increase of applications based on the WSNs, the frequency band has become increasingly congested. The sharing of unauthorized frequency bands has become the theme of extended research [1,2]. Study has shown that the IEEE 802.11 [3] network will greatly impact the performance of the ZigBee network and 802.15.4 network if they work in the same frequency band [2].
Mitola first proposed the concept of cognitive radio in a paper [4] published in 1999. They represented a new language called radio knowledge representation language (RKRI), which can improve the flexibility of the personal wireless service. In the same year, Mitola and Maguire Jr. proposed the concept of spectrum pooling [5]. Soon afterward, he expounded his view that cognitive radio would be increasingly important with the shortage of spectrum in the doctoral defense held by the Royal Swedish Academy of Sciences in 2000 [6]. With probing spectrum holes and the adaptive modulation mode, cognitive radio offers efficient dynamic spectrum access and increases the utilization of spectrum in the frequency domain or time domain.
The growing demand for wireless communication has become a great challenge [7] for efficient use of spectrum. Therefore, cognitive radio was seen as a key technology which was focused on opportunistic spectrum access. The cognitive radio network is an intelligent wireless communication system which can sense the spectrum around and quickly adjust its inner parameter to achieve the reliable and efficient communication [8].
Dynamic spectrum access can be used in WSNs. Therefore, a new type of network emerges, which is the CWSN. Typical wireless sensor networks manage finite spectrum and transmit perceived data to adjacent nodes. A fundamental aim of the wireless sensor network is to transmit large perceived data in real time and synchronously on the premise that the fewest possible resources are used. For example, in a WSN of the medical environment, a lot of nodes are used to monitor various signals of a patient and transmit them in real time.
Identically, with the growing development of the cognitive radio technology, the study of the security of the technology in various forms of networks is deepened. The trust mechanism and trust management have an irreplaceable position in the study of the cognitive network's security. In a distributed wireless network, as there is no large base station, the security of the network depends on the cooperation between users.
As a hot area of wireless system research, trust management has an irreplaceable position in network defense and security. A crucial factor of trust management is the reputation value, and it is requisite to have a further analysis as well as discussion of the reputation value and combine it with necessary technology [9]. This way, CWSN is a new concept with the following advantages.
(2) Fewer sensor nodes required to cover a specific area.
(3) Better use of the spectrum.    This paper is organized as follows. Section 2 introduces the concept of spectrum allocation and "the last diminisher" algorithm in the field of fair division. Section 3 introduces the new trust value-based spectrum allocation algorithm. Section 4 simulates the algorithm in different conditions and evaluates its performance. Section 5 summarizes the conclusion.

CWSN Construction.
The cognitive wireless sensor network (CWSN) is a new network form of cognitive radio technology based on the WSN. AS shown in Figure 1, sensor nodes have been around and achieve information interaction and data transmission by the wireless communication technology. Applying the cognitive radio technology on the basis of the traditional wireless communication technology both expands the networks beyond a single spectrum space and renders them a dynamic spectrum access feature. Without interfering with the communication of authorized users, the secondary users can choose free spectrum for data transmission in real time and self-adaptively. To solve the problem of low utilization rate of fixed distribution spectrum and frequency resource scarcity in the field of radio, it is needed to find more effective ways to fully perceive and use wireless spectrum resources.
Cognitive radio can perceive the wireless communication environment and change the system's working parameters in real time and self-adaptively by a learning decision algorithm. It has two objectives: (1) to improve the utilization rate effectively, (2) to improve the communication reliability effectively.

Related Spectrum Allocation.
Cognitive radio spectrum allocation assigns spectrums to one or more designated subscribers according to the number of users accessing networks and service requirements. The main purpose of spectrum allocation is to choose and utilize idle spectrums effectively through an adaptive strategy. The dynamic spectrum allocation strategy can effectively increase the flexibility of wireless communication, avoid conflicts between the authorized user and unauthorized user, fairly share spectrum resources, and meet user's changing requirements for different services.
At present spectrum allocation has the following major models: graph coloring model, game theory model, auction model, and interference temperature model [9]. The graph coloring model in the graph theory is more mature when applied to planning and disposing frequency in the cell in the era of cellular communication. The available spectrum of the cognitive user is influenced by the location, work status, and the coverage of the main user due to its random use of the spectrum by the main user, which changes in the idle time.
The graph coloring model was proposed by Zheng et al. based on the graph theory. In the study of spectrum allocation, the network topology mapping of cognitive users is abstracted as the graph ( , , ) [10], each vertex in the graph representing the wireless user, and each edge representing a conflict or interference between the pair of vertices. In particular, if two vertices are connected by an edge, it is assumed that the two nodes cannot simultaneously use the same spectrum. Further, each vertex is associated with a collection, which means the spectrum resources can be used by the area where the vertex is located. Because of the difference of each vertex's location, the resource collection associated with a specific vertex is distinct.
The spectrum allocation in the cognitive system can be modeled as the throughput of the game, the player being the cognitive user, game strategy being the choice of the channel, and the game effectiveness related to the quality of the channel. The mathematical description of distributing spectrums using gaming is where represents the finite set of the players, is the strategy set of the player , and ∈ is the strategy space. Define = × ; then : → is the effective function set. Each player I in the game Γ has an effective function set , which is the function of strategy chosen by the player and adversary strategy − . Spectrum allocation has a lot of similarities to the auction in economics. For example, the objects which are bidden have a certain value, which is able to bring improvement in performance to the occupants. And they both have many competitors as well. So this theory can be applied to spectrum allocation in cognitive radio. Today the auction bidding theory has been proved to be an effective way to solve the problem of spectrum allocation.
The auction model is usually used in the centralized network structure. The central controller acts as an auctioneer and the secondary users as the bidder. In every auction, bidders bid a price for spectrum resources to meet their own demand, and the auctioneer will determine a winner as ruled. Compared with other allocation methods, the advantages of the auction bidding mechanism are that it is naturally dispersed and requires less signaling exchange and computational overhead.
Interference temperature equivalent to noise temperature is used mainly as a measure of the interference power and its bandwidth. It is introduced by FCC to quantify and manage interference. In this model, the cognitive facilities working in licensed bands can adjust the transmitter power and spectrum by measuring the interference environment to avoid interference to the authorized user exceeding the specified temperature threshold.
The interference temperature model uses the interference temperature as the decision threshold that is, used as the maximum cognitive user interference signal tolerated by the authorized users to make a judgment. In the working frequency, as long as the cognitive user's accumulated radio frequency power does not exceed the set value (the threshold value refers to the maximum interference value tolerated by some frequency in a certain band), the secondary user can use this band. Any secondary user using this band must ensure that the interference to the authorized user does not exceed the threshold value. [11] is to allocate limited resources to several players fairly. Allocation could be easy when the resource is a certain material which is divisible. However, when resources are various and indivisible and players are of various interests, allocation could be difficult, for example, the allocation of 20 cows of different breeds for 3 players. Hu and Ibnkahla [12] has purposed a consensusbased protocol for spectrum sharing to address fairness in CWSN.

Fair Allocation. Fair allocation
Fair allocation is a mathematical theory on the basis of idealization and practical issues. The realistic problem is the allocation of divisible resources or materials to players who are potential owners of goods. The core issue of fair allocation is that the allocation should be conducted by players, who know the value of goods through negotiation or with the aid of an intermediary rather than an intercessor.
The fair allocation theory provides a definite standard for the division of various kinds of fairness. It aims at providing a program to implement fair allocation or proving impossibility and studying the disagreements between the theory and real life [11,13].
The assumptions about the valuation of the goods or resources are as follows: (1) each player has this own opinion about the value of each part of the goods or resources, (2) the value of a player of any allocation is the sum of his valuations of each part. Often just requiring the valuations to be weakly additive is enough, (3) in the basic theory the goods can be divided into parts with arbitrarily small values.
There have been many allocation strategies for fair allocation, most of which conflict with one another. But they can still be combined. The fairness allocation mentioned above here means that every participant can gain goods with the smallest possible difference in amount or proportion. Theoretically, spectrum resources can be divided into arbitrarily small channels and allocated to those who want to transmit data. Because of this, we borrow the "the last diminisher" algorithm and propose reputation based fair allocation for cognitive radio networks. This allocation strategy is capable of making on-demand and fair allocation for an arbitrary number of secondary users.

A Trust Value-Based Spectrum Allocation Algorithm in CWSNs
This chapter makes a detailed analysis of the spectrum allocation algorithm proposed in this paper. In the cognitive wireless sensor network, we assume that the user's reputation value has been obtained through the trust management mechanism. And in a process of our spectrum allocation, the reputation value is fixed and cannot be changed. Assuming that the needs of secondary users are not exactly the same and that the quality of channels is not exactly the same, either, it is rational for secondary users to choose the appropriate channel for data transmission. All the above ensures the effective utilization of idle channels and the reasonable and fair distribution of channels between secondary users. The fairness this article proposes is not the easy division in geometry, but rather matching one's requirement with the piece of goods. (1) The first person cuts a slice they value as a fair share.
(2) The second person examines the piece.
If they think the piece is less than a fair share, they then pass on the piece unchanged.
If they think the piece is worth more than a fair share, they trim off the excess and lay claim to the piece. The trimmings are added back into the to-be-divided pile.
(3) Each remaining person, in turn, can either pass or trim the piece. (4) After the last person has made his decision, the last person to trim the slice receives it. If no one has modified the slice, then the person who cuts it received it. (5) Whoever receives the piece leaves with his piece, and the process repeats with the remaining people. Continue until only 2 persons remain; they can divide what is left by the divider-chooser method.
The fairness of the algorithm is that none of the players can diminish the amount of goods to a value smaller than the average value according to his or her will. It is said that the result of reduction might belong to oneself. Identically, in the case of denying the benefit of someone else, the piece of goods cannot be greater than average, either. Intellectually, everyone would divide goods into average pieces in their own opinion.
In the process of polling, the method of allocating and competing for "goods" on the basis of needs is coincidently parallel with the idea of pursuing optimization in the allocation of spectrums. When allocating spectrums, different users who need to transmit data have different requirements, such as the requirement for transmission rate and band-width. Meanwhile, it is well known that as a process of multiple users towards multiple users, the allocation of spectrums should be done in a certain order. For this reason, our original intention is to try our best to guarantee that all the users who need to transmit data are able to get appropriate channels by allocating channels in a certain order.

System Parameters.
The node which needs data transmission is the center. All the nodes within the hop range form a group and then exchange reputation values at that time. In the period of time (denoted as Tt) when reputation values are exchanged, all nodes in this group adopt spectrum sensing, until the last node submits the sensing information and grades the perceived spectrum channel (this period of time is denoted as Ts). In this period of time (max{ , }), any node receiving information which needs to be forwarded will be counted as the same transmission.
It's not our responsibility to consider the production of these trust values. In order to ensure the stable operations of CRNs which support mobile computing and ubiquitous computing, the establishment of trust is an open, heatedly discussed, and challenging issue. A large amount of research has been done both at home and abroad. The authors in [14] proposed a Markov chain-based trust model for analyzing trust value in distributed multicasting mobile ad hoc networks. The method for developing a good trust management system for wireless sensor networks (WSNs) has been proposed in [15,16]. In distributed CWSNs [17], the spectrum allocation algorithm proposed can be used together with the trust management to solve some complicated problems [18,19].
The following three parameters are used to determine the user demand: the transmission rate at the previous hop, the length of the transmission data, and the vector property ( , ), which is defined to represent the main demands of each SU perceived.
The following three parameters are used to determine the channel level: the channel capacity , the maximum transmission power accepted by the channel, and the duration of the channel. Set a vector ( , , ) for each idle channel.
The time function is defined in (1), which is the ideal transmission time of the data length in the capacity channel = s.t.
∈ (1, 2, 3, . . . , ) . ( The channel capacity is related to the transmission rate at the previous hop. For > in the transmission channel, in order to reduce the decrease of the transmission rate at this hop, choose those channels whose capacity is the largest.
The duration of the channel is related to the length of the transmission data. When in transmission, it is better to select those channels whose > , being the ideal transmission time of the data length in the capacity channel . Therefore, a transmission time longer than is essential. As shown in Figure 2, because there is no central database to store the user's personal information in the distributed network, each SU is equipped with a fixed private agent. The agent comprises two parts: the utility management center and the personal database. The personal database is used to store the user trust value, demand vector, and degree of participation. The utility management center calls out the SU's information from the personal database, calculates the value of the utility function, and upgrades the information in the personal database.

A Trust Value-Based Spectrum Allocation Algorithm in
CWSNs. Order the SUs according to the rules:

S.t.:
(1) + = 1, where is the order value of each SUs. SUs decide the order to be allocated channels according to the order value from big to small. The whole flowchart of the algorithm is shown in Figure 3. When one of the SUs has the need to transmit a series data, the algorithm starts. The agents of all channels that are unused calculate their own priority levels and decide which channel owns the better characteristics. Then the SUs begin to select the satisfying channel in the order of the order value. When one SU has selected a channel, other SUs whose order value is smaller than that one have the opportunities to give opinions about the match between the SU and the channel. The last one who holds the opposite attitude towards this match will have another chance of a priority selection. When all the needs of SUs are met, the algorithm is over. Those SUs who have been allocated a channel transmit the data, and the feedback of the behaviors of SUs will reflect SUs' order value. Figure 4, channel grading is dividing and registering the channel in accordance with the assumption in Sections 3.1 and 3.2 of this section. The channel with a higher level must have a better channel capacity and longer channel idle time. It will be requested by a large number of secondary users. And the low level user may have less channel capacity, shorter idle time, or less channelallowed transmitter power. All in all, it has some parameters which cannot meet the demand of secondary users, or its channel is not welcome to the secondary users. Suppose that the data length to be transmitted at one point is and the transmission data of the previous hop is . The number of channels perceived by the secondary user is , is the capacity of channel, its transmitted power is , and the idle duration is . ( ) represents the channel's priority level.

Channel Allocation of SUs.
This part is shown in detail in Figure 5. Assume there are users in total, SU , ∈ (1, 2, 3, . . . , ), the user credibility values have been known and stored from the highest to the lowest; that is, 1 > 2 > ⋅ ⋅ ⋅ > > . Step 1. If > , which means the number of idle channels to be selected is small while the number of secondary users is large, to ensure that the secondary user with low reputation does not interfere with the channel of the user with high reputation, users who have high reputation participate in every selection of channels, and the rest of the users with low reputation will not be involved. If the low reputation user occupies the channel forcibly, its behavior will be recorded and his reputation is reduced or he is determined to be a malicious user according to the strategy.
Step 2. Choose ( ) > 1. When second users are transmitting data in a channel, we guarantee the time that second users spend in transmitting information, which means that the duration in which the channel is idle is longer than the time needed when transmitting data under perfect conditions.
Here, we assume that the time when the channel is idle has been gained in the active detecting method. For the reason that the throughput in the sensor networks is huge but the message included is about the external environment, the amount of data is small, and when taking security, efficiency, and confidentiality into consideration, different data types have different needs. Consequently, when choosing an appropriate channel, users have to choose those whose idle time is enough to do a complete data transmission.
Step 3. Under condition 1, we choose the channels with the characteristic > . In order to keep the speed of data transmission, we better choose the channels with > . In practical application, the actual data transmission speed is less than the channel capability. Sometimes we can promote the transmission speed comparing with the previous communication. Step 4. Under conditions 2 and 3, we choose the transmission power = max , ∈ (1, 2, 3, . . . , ), which means that we select the one with the highest rate from available channels. Otherwise, we can choose the channel in any method.

Channel Competition in SUs.
The flowchart is shown in Figure 6. After the second user SU whose trust value is t selects channel during the current channel choosing phase, the − second users with the highest trust values compete for a channel. Assume the trust values are set from high to low as 1 > 2 > ⋅ ⋅ ⋅ > > . And the second user with trust value selects channel .
Step 1. The second user with trust value , ( = 2, 3, 4, . . . , − ) can decide whether to compete for channel . If he decides to compete for this channel, turn to Step 2, or else turn to Step 4.
Step 2. If ( ) > 1, this means that the time needed for transmission is shorter than that in the perfect condition and turn to Step 3, or else the second user fails to use the channel and then turn to Step 1.  If exists and is greater than 0, the secondary user succeeds in this competition and accordingly can get the channel + 1 whose priority is just less than . Meanwhile, the channel is allocated to the second user with trust value and then turn to Step 4. Here it is required that the amount of data from competitors be huge and the transmission rate in the last hop be low. Through these adjustments, more secondary users will have the chance to obtain channels for transmission and do not need to wait for too long or be blocked.
Step 4. Set = , = + 1, and = + 1, and then turn to Step 1. If = + + 1 or = , it means that all the available second users have been taken into this action and turn to Step 5.
Step 5. The competition is ended. All the second users that get channels can transmit messages in the channel, and other second users stay silent.

Feedback.
Every agent of the nodes gathers the feedback information after a transmission. Whether to increase or decrease the trust value is decided by feedback information which has reached the threshold or not.
If the SUs who have been allocated an idle channel correspond and transmit data normally, increase the trust value by fifty percent. If the SUs have the following behaviors, decrease the trust value to a half: (1) having nothing to do with the allocated channel, The trust value is related to order value, which decides the SUs' sequence in allocation. When an idle channel is allocated to an SU, the competing SUs cannot take it into account. That is to say, the trust value determines the ownership of the idle channels. Identically, the trust value also plays an important role in the field of trust management, and some more in-depth research can be done in the near future.

Simulation and Evaluation
"The last diminisher" algorithm proposed by Banach and Knaster can solve the "Cake Cutting" problem impartially, but it cannot provide a satisfying solution for every user. Presume there is a piece of cake with multiple flavors, chocolate, cream, strawberry, and so forth, people who share the cake have different taste for cakes, and different parts of the cake have different values to different people. Geometrically equal distribution and simple equal distribution cannot solve the "Cake Cutting" problem. Therefore, this article uses "the last diminisher" algorithm for reference but does not distribute frequency spectrums totally depending on the algorithm. This article presents a method by which users can get satisfying frequency spectrums according to their particular needs.
Here, the frequency spectrum is the cake we mentioned before. We know different parts of the cake have different flavors. In other words, different idle channels have different parameters. Furthermore, users not only care about whether they can get a channel but also whether the channel they get can satisfy their needs. Therefore, "the last diminisher" algorithm cannot meet our requirements.
Banach and Knaster provided a useful thinking: polling for advice and then getting the "cut cake".
The frequency spectrum distribution method this article presents can ensure the following aspects: (1) user with the highest reputation value is the first to select, and he is certain to get the channel he selects. Even if user disagrees with user 's selection of channel and user doesn't get the channel this round, user will have to select his ideal channel from channels except . In the next round, User still possesses the highest reputation value, and thus he will definitely again select channel , (2) users who have high demands can select high-level channels; users who have low demands can select lowlevel channels, (3) users with low reputation levels cannot get channels selected by users with high reputation values, and even if they finally get that channel, that channel is a degraded channel.
If users with a low reputation value or demands select a channel that users with high reputation value or demands need, then we regard these users as malicious users and reduce their reputation values according to the situation in the next round's reputation value calculation.
In order to further explain that our method has outstanding performance, we build a simulation environment. The number of secondary users and available channels are given, the sensor network has numerous and densely distributed ground nodes, and thus the number of users are much larger than that of channels. In order to guarantee randomness and fairness of the simulation environment, every user has an initial random reputation value and random transmission data with the data length, data type, and transmission speed of the last jump. If no data is to be transmitted, then the data length is 0. For available channels, the channel capacity, idle duration, and maximum bearable transmission power of the channel are random in a certain range. Nearly all simulation parameters are random, which is most like the real sensor network environment. We set the number of users as 100 and that of available channels as 20, and other parameters are random in a certain range and then perform 100 experiments. As is shown in Figure 7, the network's ratio of actual throughput to ideal throughput is generally a relatively stable value, 0.7. The throughput ratio should be 1 in the ideal situation, which means all idle channels can be used by secondary users, and the transmission rate equals the channel capacity.
When it comes to practical simulation, we need to allocate channels to users following our algorithm. Random parameters may lead to > or = 0 not being satisfied, and thus some idle channels cannot be selected and fully utilized by users because of their inappropriate parameters. This is also characteristic of the actual sensor network. We can see from Figure 7 that the simulation results and simulation count have no regularity, which means our algorithm will have stable and efficient throughput under any circumstances.
On the other hand, the utilization rate is a public focus. We combine the utilization rate and network throughput and conduct persuasive comparison. The utilization rate is the ratio of the number of channels allocated to users after one allocation to the total number of channels.
We set the number of users as 100 and that of channels as 10, 20, 30, and 40, respectively, and the results are shown in Figure 8.
(1) The pattern of the channel utilization rate is similar to that of throughput, which means the throughput value will be greater if the channel utilization rate is higher.
(2) There is no fixed relation between the channel utilization rate and the number of simulation. When the number of available channels is quite small but the total number of channels is big, all channels will be International Journal of Distributed Sensor Networks distributed to secondary users, which is the spectrum utilization rate shown in Figure 8.
As is shown in Figure 9, in 20 simulations, the spectrum utilization, which is now equal to channel utilization, varies from the trust value. With the trust value increasing, the spectrum utilization has an obvious growth particularly. In our simulations, we set a large number of parameters randomly. In the 12th simulation, the spectrum utilization is highlighted when the trust value is 0.4, which shows our simulation circumstance is close to reality.
This article analyzes and deals with the distribution of idle channels of different parameters to secondary users with different needs, with reference to the "Final Cutter" method. We basically guarantee every user can get the suitable spectrum, and the performance of our method is basically stable for the whole network. The variation of channel parameters and user needs caused by external disturbance will not influence the whole network's status.

Conclusion
This article proposes an algorithm for dynamic spectrum allocation in CWSNs, which integrates the idea of "the last diminisher" in the field of fairness allocation, the demand of SUs, and the channel characteristics.
At the beginning of the article, we give a brief introduction to the necessity of the CWSN spectrum allocation and put forward our main idea. In Section 2, we find works related to our article. The next two sections are our contributions to allocating spectrum recourses fairly, including the algorithm and simulation. The algorithm, aiming at complicated realistic sensor networks, has stable output and channel utilization.
The WSNs are facing increasingly congestible frequency spectrums and strait channels. In dealing with the inadequacy of spectrum resources, we still have a long way to go. Further researches need to be done on the cognitive WSNs from the aspects of trust management, spectrum sharing, power control, and so forth.