Optimal Power Allocation for a Relaying-Based Cognitive Radio Network in a Smart Grid

This paper obtains optimal power allocation to the data aggregator units (DAUs) and relays for cognitive wireless networks in a smart grid (SG). Firstly, the mutual interference between the primary user and the DAU are considered, and the expressions of the DAU transmission signal are derived based on the sensing information. Secondly, we use the particle swarm optimization (PSO) algorithm to search for the optimal power allocation to minimize the costs to the utility company. Finally, the impact of the sensing information on the network performance is studied. Then two special cases (namely, that only one relay is selected, and that the channel is not occupied by the primary user) are discussed. Simulation results demonstrate that the optimal power allocation and the sensing information of the relays can reduce the costs to the utility company for cognitive wireless networks in a smart grid.


Introduction
Smart grid (SG) is the modernization of generation, transmission, and distribution of a power grid system with the integration of advanced information and communication technologies (ICTs).The decentralized nature enables the integration of renewable energy resources and promises a two-way communications between consumers and utility company, which will improve the efficiency of utility company programs such as demand response, customer participation, and advanced smart metering [1].In a smart grid, regulation is a type of ancillary service which continuously balance supply with demand in electricity markets under normal conditions [2].Generally, the regulation service can be provided by on-line generation units that are equipped with the automatic generation control (AGC).In ancillary service markets, the utility company purchases the AGC service according to the errors between the generation and the load.Thus, the electricity costs to the utility company are increased with the errors between supply and demand.It was demonstrated that the errors can be reduced by the demand-side regulation [3,4], which is dependent on the two-way communications between the utility company and the consumers.
Cognitive radio (CR) [5] is widely recognised as a dynamic spectrum access technique, which enables unlicensed users to share the spectrum with licensed users [6,7].The author [8] investigated how CR can be utilized to serve a smart grid deployment, from a home area network to power generation.It is recognized as a promising technology to address the communication and networking problems in the smart grid [9].Under the background of the smart grid [10], the two-way communications [11] can be implemented by the advanced metering infrastructure (AMI), which includes cognitive home area networks, cognitive neighborhood area networks, and cognitive wide area networks.Moreover, several advanced communication technologies have been applied to demand response in a smart grid [12][13][14][15][16].In Reference [12], the authors propose two different architectures for CR communications systems based on the IEEE 802.22 standard to accommodate the current and future needs of SG communications.Cognitive radio-enabled smart grid was presented for demand response to reduce the communication outage [13].The book [17] provided readers with the most extensive coverage of technologies for 5G wireless systems to date.A cooperative spectrum sharing strategy based on the Nash bargaining solution for cooperative cognitive systems and a power allocation technique with improved energy efficiency for MIMO-OFDM based CR with tolerable degradation at system capacity was proposed in References [18] and [19], respectively.The authors considered the problem of resource allocation in a two-way relay network [20].In Reference [21], the authors studied the resource allocation algorithm for CR secondary networks with simultaneous wireless power transfer and secure communication based on a multiobjective optimization framework.The differences of the proposed work with the above literature are shown in Table 1.

Indexes
Throughput Power Allocation Cooperation Signal-to-Noise Ratio (SNR) Packet Loss Recently, cooperative relaying has been proposed for communications in a smart grid.The basic idea of cooperative relay is to use relays to help mobile users to transmit to the destination, in order to combat the impact of fading [14] and improve the spectral efficiency [15] for smart grid communications.In Reference [16], D. Niyato et al. proposed a cooperative relay-based meter data collection networks in a smart grid, in order to reduce the electricity costs.The authors developed a scheme that optimized the user assignment and power allocation optimization in CR networks [22].The secondary user power allocation problem in cognitive radio networks with uncertain knowledge of interference information was studied in Reference [23].The authors in Reference [24] investigated the energy efficient power allocation for orthogonal frequency division multiplexing based cognitive radio networks (CRNs) in the underlay mode.
Particle swarm optimization (PSO) is a population based stochastic optimization algorithm which was originally introduced by Kennedy and Eberhart [25,26].PSO has been extended to many application areas such as function optimization [27], artificial neural network training [28][29][30], fuzzy system control [31][32][33][34], power system [35,36] and image processing [37].This algorithm is motivated by the emergent motion of the foraging behavior of a flock of birds.PSO consists of a swarm of particles.Each particle represents a potential solution, which is a point in the multi-dimensional search space.The global optimum of PSO is regarded as the location of food.Each particle has a fitness value and a velocity to adjust its flying direction according to the experiences of the particle itself and its neighbors.PSO is simple in implementation and has good convergence properties when compared to evolutionary algorithms [38].The advantages of PSO have caused it to become one of the most popular optimization techniques.
To the best of our knowledge, the combination of the relaying and CR in a smart grid has not been considered in the literature.In this paper, we propose to use both relaying and CR in smart grid communications, in order to reduce the packets loss and improve the spectrum utilization simultaneously.We consider the cognitive wireless network in a smart grid and focus on how to reduce the packets loss in the downlink transmission and improve the quality of communication, and then minimize the costs to the utility company.The main contributions of this paper are as follows:

•
This paper converts the sensing errors into the channel available confidence and introduce the average interference constraint to the cognitive wireless networks in a smart grid.

•
We establish a cost model based on the statistical analysis with the regulation errors of a direct load control method for cognitive wireless networks in a smart grid.Specifically, the power allocation problem based on the sensing error information was formulated as a nonlinear optimization problem.Then we use the PSO algorithm to search for the optimum.

•
We demonstrate that the sensing information in power allocation can reduce the costs to the utility company for cognitive wireless networks in a smart grid.
The rest of the paper is organized as follows.In Section 2, we describe the cognitive wireless network model and the cost model to the utility company in a smart grid.The power allocation problem is formulated as a multi-variable optimization problem and PSO algorithm is employed to seek the optimal solution in Section 3. Simulation results are shown in Section 4. Finally, we draw conclusions in Section 5.

Cognitive Wireless Network Model in a Smart Grid
Consider a downlink cellular cognitive wireless network, which includes the primary network and cognitive radio network, as shown in Figure 1.The cognitive radio network is implemented by two-way communications between the utility company and the consumers.The DAU that is deployed by the utility company collects the temperature settings from the consumers and forwards them to the utility company in the uplink transmission.Meanwhile, the DAU receives the control commands from the utility company and forwards them through the relays to the consumers in the downlink transmission.In the primary network, the primary transmitter (PT) transmits to the primary receiver (PR).Assume that the PT transmits to the PR with a fixed power, and the DAU uses the vacant channel to transmit information according to the sensing information.

Cognitive Wireless Network
The DAU accesses to the channels of the primary user by spectrum sensing.The available channel of the primary user is divided into k carriers, and the existing probability of the primary user in each carrier is p q .We use the binary variables to represent the activity of the primary user on the carrier k .We denote C k = 1 when the primary user is active on the carrier k and C k = 0 when the primary user is inactive.Ĉk is the sensing results of the DAU on carrier k.We denote Ĉk = 0 when the carrier is occupied by the primary user and Ĉk = 1 otherwise.In practice, the sensing results of the DAU are not accurate, which causes false alarm and mis-detection.The false alarm denotes the carrier that is actually vacant when the DAU believes that the primary user occupies the carrier due to sensing errors.The mis-detection denotes the carrier that is actually occupied by the primary user but refers to the case when DAU believes that the carrier is vacant.We denote the false alarm probability is p f and the mis-detection probability is 1 − p d .When the mis-detection happens, the cognitive network communication can produce interference to the PR, and the instantaneous interference can be expressed as where P sr is the transmission power of the DAU transmitter or relays and H sr,p is the channel gain from the DAU transmitter or relays to the PR.We need to ensure that the average interference of the primary user is lower than the interference temperature threshold when the DAU occupies the communication channel of the primary user [39][40][41], i.e., where I 0 denotes the interference temperature threshold of the primary user.The instantaneous interference from the primary user to the gateway or relay is described as follows: where P p is the transmission power of the primary user, H p,dm is the channel gain from the PT to the DAU receiver or relay.The corresponding average interference can be expressed as

Packets Loss Model
We consider a communication model as shown in Figure 1, where the transmission strategy is the cooperative relaying.Without loss of generality, we only consider the packets loss in the downlink transmission and formulate the packets loss rate as where T denotes the arriving rates of the DAU, R is the receiving rate of the gateway, and g is the correct transmission ratio from the gateways to the consumers.

Transmission Formulation of The Network
We assume that the PT can adjust the transmission power according to its own throughput requirements.Moreover, the utility company is restricted to the average interference temperature of primary user and improve the transmission quality as far as possible, in order to reduce the packets loss and the costs.Under the condition of the mutual interference, the DAU and the relays constitute a virtual antenna array through collaboration, and the relays terminal and DAU receiver will introduce two beamforming weights.In addition, the weight of the relays terminal can eliminate or reduce the interference from other networks, and the DAU is able to obtain a higher Signal to Noise (SNR).Next, we utilize the channel confidence levels to denote the degree of the available channel.We assume that the DAU scans all the channels of the primary user and the results are sent to the DAU transmitter.The channel confidence level is formulated by the following conditional probability: where γ k ∈ [0, 1], and | Ĉk | denotes the number of Ĉk = 1 in the sensing results.For cognitive wireless networks in a smart grid, the communication is composed of two scheduled time slots: within the first time slot, the relay receives the information from the DAU and the interference from the PT simultaneously.x s and x p are the information generated from the DAU transmitter and the PT, respectively.The received signal [42][43][44] at the relay is denoted by y s,m , where P s and P p are the transmission power of the DAU transmitter and the PT, respectively.h s,m and g m are the channel-to-noise ratio from the DAU transmitter and the PT to the relay, respectively.
η s,m denotes the zero-mean circular symmetric complex Gaussian noise at the DAU transmitter and the relays.In Equation ( 7), the received signal at the relays consists of three parts.The first part is the information that the relays receive from the DAU transmitter.The second part is the interference that the relays receive from the primary user.The third part is the background noise.The relays receive average information from the DAU sender as follows: In the second time slot, we employ the amplify-and-forward (AF) [45] relay strategy for the cognitive wireless network in a smart grid.The relay receives the information that the DAU transmitter retransmits to the PR.By introducing the beamforming weight vector w m , the retransmission signal can be represented as In the DAU receiver, by introducing the beamforming weights w d [46], the received signal at the DAU receiver is where According to Equation (10), we can obtain the signal-to-noise ratio [47] that the information from the DAU transmitter through the relays to the DAU receiver as follows: where S m and N m are the received signals and background noise, respectively.And the expression are as follows: and Without loss of generality, we assume that the noise power of all links are the same and denoted as σ 2 .For the cooperative relaying transmission from the utility company to the consumers under the amplify-and-forward (AF) relaying strategy, the receiving rate [48] of the gateway is defined as where W is the transmission bandwidth of the DAU.Substituting Equations ( 11)-( 14) into Eqiation (5), gives

Costs to Utility Company
In this section, a case of the temperature-priority control strategy which was developed in [49] is studied.As illustrated in Figure 2, the "on" loads with lower indoor temperatures have higher priorities to turn off, and the "off" loads with higher indoor temperatures have higher priorities to turn on.Therefore, the aggregated loads are ranked by their indoor temperatures.Then the loads with lower priorities will be turned on or off in sequence until the load can combine the AGC signal with the baseline load to follow the reference signal.Taking the packets loss rate P r = 5% as an example, we can obtain the tracking error distribution of the load control strategy through the MATLAB and EasyFit software [50].As shown in Figure 3, the tracking errors follow the normal distribution.For the reliability of the communication, the probability of providing ancillary service is required to be larger than 99%.Thus, the utility company has to purchase u + 3σ AGC service because there is P(µ − 3σ <= x <= µ + 3σ) ≥ 99% under the normal distribution.We have where µ is the expectation, σ is the standard variance, and p a is the price per unit fraction of AGC service.))g

Problem Formulation and Solutions
In this section, we first give the problem formulation and then derive the optimal power allocation to the DAU and the relays.The problem is equivalent to selecting the optimal power allocation of the DAU p s and the relay p m such that the costs to utility company are minimized, and the optimization problem is cast into the following problem.
The first constraint is the total power restrictions of the cognitive radio network, the second constraint is the interference temperature threshold constraints, and the third constraint denotes that the transmission of DAU transmitter and the relays should be less than the interference temperature threshold constraints for primary user.
Remark 1.We can observe that (P1) is a non-convex optimization problem according to Equation (17).The traditional gradient optimization methods cannot be applied to solve it.Next, we employ PSO to search for the optimum.Specially, the optimal solution can be obtained by using the KKT condition when the optimization problem has only one relay .

PSO Algorithm
We use the PSO algorithm to solve the multi-variable optimization problem [51].For an optimization problem of D variables, the potential solution of the optimization problem can be described as a point in D-dimensional space.Each particle has a velocity vector to determine its direction and a fitness value to measure its corresponding optimization state.,The position and velocity are adjusted in D-dimensional search space according to the current optimal particle.
The process can be converted into a mathematical problem as follows.The PSO is initiated by a group of random particles (solutions), and then it searches for the optimum by updating generations.Each particle updates its position by using best present (pbest) and global best (gbest) in the next iteration.The ith particle in D-dimensional space is represented as The velocity and location update strategies of the ith particle are defined by : where c 1 and c 2 are the constriction factors.c 1 represents the weight that the ith particle tracks its own historical optimal value pbest i , and c 2 represents the weight that the ith particle tracks the whole group's optimal value gbest.All particles use the same values c 1 and c 2 .pbest i and gbest are updated all the time according to each particle's fitness value.Moreover, rand1 d i and rand2 d i stand for random values that are in the range between 0 and 1.
The position of each particle represents the variables of the system.In this paper, the variables are the DAU's power allocation P s and the relays's power allocation P m .The flowchart of the PSO algorithm is given in Figure 4, and the pseudo-code of PSO is given in Algorithm 1 as below.

Algorithm 1 PSO Algorithm
Input: Z: size of the whole population; iter-max: maximum iterations; Initialize each particle's position p d i and velocity v d i .Output: each particle's position p d i .1: for iter=1: iter-max do 2: Calculate their fitness values and update pbest i , gbest; 3: Update each particle using Equations ( 18) and (19)

The Solution with One Relay
The DAU selects one relay to transmit information to the consumers.In that case, the costs to the utility company can be denoted as In order to minimize the costs to utility company we need to select the optimal power allocation of the DAU p s and the relay p m .And The optimization problem can be described as follows: We solve the above optimization problem by the Karush Kuhn Tucker (KKT) conditions and obtain the optimal power allocation solution: and ).
The optimal power allocation solution Equation ( 21) is meaningless when γ k = 1, therefore, we need to analyze the special case that γ k = 1, which denotes that there is no interference between the primary user and the DAU.Thus, the corresponding interference constraints should be deleted.Moreover, the relay receives the signal of the primary user as follows: The relaying signals under AF relay strategy are as follows: The received signals from the relay at the DAU receiver are: Substituting Equations ( 23) and (24) into Equation (25) and the signal-to-noise ratio can be expressed as Therefore, the optimization problem (P1) can be converted to the following optimization problem: (P3) min Z 2 s.t.P s + P m ≤ P t The optimal power solutions based on the KKT conditions are as follows:

Simulation Results
In the simulation, we consider a communication system consisting of a primary user, a DAU, a relay, and one gateway shared by the consumers.The primary transmitter is located at the origin, the DAU is distributed in (0 m, 30 m), the gateway is located at (20 m, −20 m), and the relays are randomly distributed in the area of (100 m × 100 m).The total system bandwidth is set to be W = 10 4 Hz, the probability of correct transmission from the gateway to the consumers is g = 0.99, and the base price of the AGC service is p a = 20 $/MW.The arriving rates of the DAU are 100 bits/s, i.e., T = 100 bits/s, and the noise power of all communication links is 10 −1 W, i.e., σ 2 = 10 −1 W. In addition, the existing probability of primary user in the carrier is p q = 0.5, the false alarm probability is p f = 0.2, the correct detection probability is p d = 0.8, and the interference threshold is I 0 = 6.3096 db.In addition, the DAU's maximum and minimum power allocation are 12 mW and 0 mW, respectively.The relays's maximum and minimum power are 5 mW and 0 mW, respectively.
In the cognitive radio network, the relays sense the occupancy of the PR's carriers, and then transmit the sensing results to the DAU.Hence, the DAU calculates the channel confidence level by combining all the sensing results.Furthermore, the DAU determines the relaying power allocation.In the simulation, we use the binomial distribution of 0 and 1 to generate the sensing results.
The convergence results of the best fitness values (i.e., the costs to the utility company) with different number of relays are shown in Figure 5.It is observed that the PSO algorithm can converge to the optimal solution.Comparing the fitness values with different number of relays, we observe that the the costs to the utility company can be reduced by deploying multiple relays.The costs to the utility company Z versus the total power P t are given in Figure 6.The costs to the utility company have the similar changing trend under the direct transmission and the cooperative relaying, but the cooperative relaying can reduce the costs to the utility company dramatically.
The performance comparisons between the direct transmission and the cooperative relaying are given in Table 2.It is shown that the cooperative relaying can reduce the SNR , the packets loss rate, and the costs to the utility company dramatically.The relationship between the costs to the utility company Z and the total power P t under Sensing Information (SI) and Non-Sensing Information (NSI) is shown in Figure 7.It is straightforward to observe that the costs to the utility company increases with the total power, however, the costs to the utility company under SI has lower cost than the costs under NSI significantly.As shown in Figure 8, the costs to the utility company are examined with the change of the existence probability of primary user under different total power P t .It can be observed that the costs to utility company under different total power have the similar trend and the costs to utility company is decreasing with the total power before the critical total power and remain the same and then increasing with the total power after that.The existence probability of primary user (p q ) The costs to the utility copany (Z 1 /$) P t =50 mW P t =20 mW P t =80 mW The relationship between the costs to the utility company and the existence probability of primary user in different total power P p is shown in Figure 9.The costs to the utility company both reach the rock bottom and remain the same, but begin a slow increase after that.The existence probality of primary user (p q ) The cost to the utility company (Z 1 /$) P p =50 mW P p =100 mW P p =500 mW

Conclusions
This paper studies the power allocation problem for a cognitive wireless network in a smart grid based on the sensing information and minimizes the costs to a utility company by using the PSO algorithm to search for the optimal power allocation under the interference temperature threshold constraints of primary users.We obtain the optimal power allocation for cognitive wireless networks in a smart grid and study the cases that only one relay is selected by DAU and the channel is not occupied by the primary user.The simulation results illustrate that the optimal power allocation and the sensing information can decrease the costs to the utility company for cognitive wireless networks in a smart grid.This paper only considers one DAU and that will limit the performance of the cognitive radio network in a smart grid.In the future, we will extended the model to the case with multiple DAUs and multiple relays.

Figure 1 .
Figure 1.The cognitive wireless network in a smart grid.

P
Pri iori ity ord der

Figure 3 .
Figure 3.The tracking error distribution under the packets loss.

Figure 4 .
Figure 4.The flow chart of particle swarm optimization (PSO) algorithm.

Figure 5 .
Figure 5.The convergence curve of the fitness value with different number of relays.(a) The convergence of the fitness value with one relay; (b) The convergence of the fitness value with six relays; (c) The convergence of the fitness value with ten relays.

Figure 6 .
Figure 6.The costs to utility company under the transmission modes.

5Figure 7 .
Figure 7.The costs to utility company under Sensing Information (SI) and Non-Sensing Information (NSI).

Figure 8 .
Figure 8.The costs to utility company under different P t .

Figure 9 .
Figure 9.The cost to utility company under different P p .

Table 1 .
Differences of the proposed work with the literature.