Image Transmission over Cognitive Radio Networks for Smart Grid Applications

: Today, Smart Grids (SGs), as the goal of the next-generation power grid system, span extremely wide aspects from power generation to end-user utilities. In smart grids, Energy and Information ﬂows are mutually dependent and performance degradation of one side may have a high impact on the other side. In this work, we introduce our architecture for monitoring of Wind Turbine (WT) farms in smart grids. In our proposed system an industrial camera is embedded on a Wireless Cognitive Radio node for each WT to capture appropriate images and stream videos to the cognitive coordinator. Any packet loss in transmission between an embedded cognitive node and the coordinator can degrade peak signal-to-noise ratio (PSNR) of the received images. The image streaming is a delay sensitive transmission which should be done in harsh environments in SGs. To tackle these challenging issues, we introduce our efﬁcient model, called JOPSS, for joint optimization of both packet size and Number of Spectrum Sensing Iterations (NSSI) during image transmission in time-restricted conditions. We deﬁne our proposed objective function as the quotient of the Overhead Time and the Effective Transmission Time (ETT). In addition, we introduce our methods based on the Minimum of Overhead Time Channel Selection (MOTS) for the efﬁcient channel selection along with Dynamic Parameter Updating Procedure (DPUP) to beneﬁt different strategies in Mandatory and Proactive Handoffs (MHO/PHO). The obtained results show that noticeable improvements in both PSNR and feature-similarity (FSIM) can be achieved on our models JOPSS and JOPSS-SAFE, respectively.


Introduction
Nowadays, the concept of Smart Grid (SG) networks as the next generation of electricity networks covers various aspects of technical, economical and social affairs. In these networks, a two-way path is considered for both Energy and Data flows [1][2][3][4]. These two flows are not only independent but also have mutual functional effects [5]. Smart grids utilize modern communication networks [6][7][8][9], cyber security measures [4], computational intelligence and efficient information systems throughout the energy production supply chain including distributed generation (DG) resources [10], transmission lines, substations, distribution lines, and end-users as an integrated complex system [11,12]. This description covers a full range of energy systems from the production point to the endpoints at the customer section. Its purpose is to provide a clean, safe, reliable, flexible, and stable system. In these wide networks, interoperability of various production technologies, information and communication technologies with each other and adapting them to traditional infrastructures of power network leads to the complexity of smart grids [12][13][14].
With the development of smart grids, many new applications are also developing [5]. One of the most important issues in the development of smart grids is communication networks which should transmit a wide range of information. There are many different communication technologies for the infrastructure of smart grids [1,[15][16][17]. Considering the fact that smart grid is a very wide and complex system of systems with high industrial standards, designing of communication networks must be done in such a way that improves quality of service (QoS), tolerance capability and reliability [18].
The smart grid communication technologies cover various types of networks with different areas and applications which should be fitted with relevant requirements [12,19]. Some network types are mentioned below [20]: Wide area networks (WANs) which connect large geographic areas. Phase Measurement Units (PMU) [21][22][23], and Wide Area Monitoring Systems (WAMS) [24] are some examples of these networks . WAMS is the only reference that provides information about the angles of current and voltage of the network simultaneously and precisely throughout the entire network [9]. 2.
Field Area Networks (FANs) or Neighbor Area Networks (NANs) [25,26] which provide infrastructures for communication among Intelligent Electrical Devices (IEDs) together and their connections with circuit breakers, actuators, and transformers for automation of DGs, substations and monitoring lines in Advanced Distribution Automation (ADA) applications of SGs.

3.
Home Area Networks (HAN) which includes customers' networks and other application networks in customer domain for home automation, smart homes, smart meters, and etc. [20,27].   [28].
Wide ranges of network types with various data mean that these infrastructures should carry a massive amount of information such as control signals, measured data, monitoring data, multimedia end etc. via communication networks. In addition to the challenging issue of high volume data transmission, the end-to-end delay is an extremely important problem for SGs, especially for power protection systems. For example, in circuit breakers, any latency in the control command signals can lead to destructive impacts on the power network. Therefore, IEEE and IEC, as two main standard organizations for power systems, had defined solid standards for delays in the SGs including the IEEE 1646 [29] and IEC 61850 [28]. Some details about these standards are collected in Tables 1 and 2. Table 1. IEEE 1646 standard on communication timing requirements for electric substation automation [29].

Information Types
Internal to Substation External to Substation and Video data streams 1 s 1 s Table 2. IEC 61850 communication networks and systems in substations: communication requirements for functions and device models in Smart Grids (SGs) [28].

Message Type Example Application Time Constraint
Type 1 Fast messages such as circuit breaker commands and states Now, there are increasing demands of multimedia applications in SG communication networks that inherently require a huge amount of bandwidth and well-designed resource allocations methods. For example, wind turbines (WTs) are considered as high-cost devices that have advance maintenance services [30]. The WT conditional monitoring and diagnostics are actually a complex challenge. In order to increase the lifetime of WTs and reduce the maintenance cost, it is essential to have accurate prediction of system faults and failures using advanced Non Destructive Tests (NDTs) methods during in-service operation [31]. These systems usually benefits smart sensors with artificial intelligence and machine learning techniques to perform advance inspections [5,[32][33][34][35][36].
In this paper, our main goal is to implement an appropriate wireless telecommunication infrastructure to send images of thermal cameras mounted on wind turbine towers (WTTs). For this purpose, an efficient design of the Media Access Control (MAC) layer based on cognitive radio (CR) technology with consideration of delay constraints which were defined in smart grid standards is aimed. This communication structure provides inspection tools for fault detection and NDTs purposes in wind farms. This platform can also be used to prevent outage and its consequences. However, it is subject to the accuracy of the performance of the communication network and its efficiency. The remainder of the paper is written as follows: In Section 2, related works are discussed. In Section 3, the proposed MAC layer model is elaborated in full details. Then in Section 4, obtained results of our simulations are presented and finally, the conclusion and discussion are stated in Section 5.

Related Works
In smart grids, there is a diverse range of sensors and IEDs in value chains from consumers to DGs and vice versa. Although scalar sensors in the smart grids can provide valuable data, they also suffer from their limited information and restrictions [37,38]. Thus, there are increasing needs for multimedia applications that require additional bandwidth for intranet communications within SGs [38][39][40]. In fact, there is the potential for massive multimedia applications for both end-users and commercial/industrial sectors in SGs [37][38][39][40]. For example, wireless surveillance cameras can be installed in substations (NAN), home electric appliances and smart meters (HAN) to achieve high levels of safety and security [41]. Multimedia data that collected can be analyzed either to identify network faults and failures or to detect tampering of smart meters. Another example of multimedia applications in SGs was presented in [42]. They deployed multimedia sensors for solar panels that can predict the amount of energy produced [42]. In [5], a new idea based on computer vision and a wireless camera network was introduced to estimate wind turbine velocity. This information can be used for energy predictions in DGs. Having an accurate estimation of the production rate of DGs plays a significant role in load management and optimal power distribution within the power network [43].
These new services in SGs depend on ICT infrastructures. Among all smart grid experts, there is a general agreement on the need for two-way communication networks to establish the flow of information among the different components of the power network. However, there is still many debates about which of the specific communication technologies (both cable and wireless) should be applied in different network types in SGs [1,15]. Indeed, this is a hard challenge among researchers in this field of work and there is no clear and applicable response to the issue until now [44,45]. Given the fact that the effective information sharing throughout the network is a key factor to the success of smart grid technology, SG communication subsystems should meet quality of services mentioned in the SG standards [46].
Nowadays, we face huge growth of wireless technologies in the form of cellular networks, satellite networks, wireless sensor networks, IoT and etc [47][48][49][50]. Wireless networks have different strengths and weaknesses compared to wired networks. Due to the wide advantages of wireless networks, many studies address the weaknesses and persist to decrease their negative effects as much as possible. However, there are major challenges in the design and development of delay-sensitive and high bit rate wireless communication networks over SGs. Some of these problems are as follows: 1.
Need to transfer high volumes of information, including scalar sensors, measurement tools, multimedia data and control signals [17,51].
The low rate of data transmission on existing standards such as IEEE 802.15.4 and their low performance in delay-sensitive applications [52].

4.
Managing media communication with heterogeneous Quality of Experience (QoE) for a wide variety of both users and data [12,13,53].

5.
Renewable and clean power resources such as solar energy and wind turbines usually have a wide geographic distribution in places where there are not any communication infrastructure [13,19].
Among all wireless solutions in SG applications, wireless sensor network (WSN) is one of the main options in future generation power networks. WSNs are very low cost, scalable with high standards [41,[54][55][56]. Indeed, flexible WSNs can be a feasible and economical solution for communication platforms in measurement, monitoring, inspection, and remote sensing tasks in SGs [45]. In [57], the use of wireless sensor network for electrical power systems along with opportunities and challenges had been investigated and a practical evaluation was presented in different environments of the electrical power system. They concluded that with the help of wireless sensor networks, it is possible to identify outages in the power network and manage it before any hierarchical damage on the network. In fact, the real-time recognition of network faults based on WSNs can play a significant role in outage reduction and optimization of related parameters such as System Average Interruption Frequency Index (SAIFI) and System Average Interruption Duration Index (SAIDI). Other research works in the use of wireless sensor networks are available in [54,55,58]. In [54], the implementation of an intelligent monitoring system on more than one wireless sensor network, with particular emphasis on constructing a secure routing infrastructure using routing protocol for low loss power networks was presented. In [56], a closed-loop energy management scheme with a WSN was introduced, which can be used as the network infrastructure of an industrial energy management system. Its importance lies in its high security, intelligence, and low cost hardware.
In [53], three wireless sensor networks named HART, Zigbee, and ISA100.11a were evaluated. All these networks are based on IEEE 802.15.4 standard protocol and available as low-cost industrial options for smart grids. But their applications are limited to low bitrate applications so they are not well fitted to delay-sensitive and high volume data transmission in multimedia applications. Generally, using traditional WSNs in SGs suffers from some restrictions which are listed below:

•
Using overcrowded ISM bands with high delay due to high competition in channel access [59,60].

•
High retransmission rate because of high interference in ISM bands [45,61]. • Low energy efficiency due to high retransmission [62][63][64]. • These networks were essentially developed for low data rate applications with low efficiency for multimedia transmission [52].
In contrast to classical sensor networks, it is possible to benefit from cognitive radio networks (CRNs). Cognitive radio (CR) is a very important wireless technology for achieving spectrum efficiency. In CRNs, two networks are defined, the first one named primary networks and the second one called secondary networks. The licensed bound are dedicated to Primary Users (PUs) but Secondary Users (SUs) also can use them with lower priority providing that they are Idle [62,65,67]. Opportunistic usage of unoccupied licensed bands in CRNS can increase the spectral efficiency noticeably. Due to the availability of the licensed band and the possibility of transmission based on multichannel methods, interference will be reduced in large-scale cognitive radio networks [68]. As a result, CRNs are increasingly being developed in both infrastructure-based networks and Ad Hoc/Sensor Networks in recent years [67].
Ref. [69] had studied the performance of the innovative hierarchical modulation based multimedia streaming in CR communication systems with this assumption that imperfect channel sensing on transmission power level and also interference were accessible. In this research, the efficient power control method that can minimize weighted sum of average bit error rates (BERs) of high priority (HP) bits and low priority (LP) bits or its upper bound subject to peak/average transmit power and average interference power constraints was introduced and a low-complexity power control approach was developed. They had achieved closed-form expressions of error probabilities for both HP and LP bits in hierarchical quadrature amplitude modulation (HQAM) over Nakagami-m fading channels under sensing uncertainty. Their focuses were more concentrated on the physical layer (PHY) rather than the MAC layer.
In [70], they introduced a model for multimedia traffic transmission over cognitive radio TDMA networks under secondary collision errors. They used a model based on the redundancy for link maintenance to compensate for any spectrum resource loss due to the primary traffic reclaims. Their model had aimed minimization of the collision effects to increase the Goodput but the system suffers from high complexity.
Among all available and frequently used multimedia formats, JPEG2000 has a lot of practical features that make it a viable choice for CRNs [71]. In [71], a new channel allocation algorithm found on JPEG2000 and OFDM (orthogonal frequency division multiplexing) was introduced, which improved the quality of the SU's received image by providing dynamic access (DA) to the available spectrum pool, without violating the interference requirement to the PU. The maximization of Signal to Noise Ratio (SNR) was aimed at this work to get higher QoS but it just limited to JPEG2000 standard.
In this work, we also have replaced traditional WSN with Cognitive Radio WSN, so called CRSNs. In the next section, full details of our customized CR-MAC layer for image streaming over smart grids are presented.

Proposed MAC Layer for Image Streaming over CRSNs
In multimedia applications, time-bound constraints are very challenging [66,72,73]. In this work, sending an image within the given time should be completed. In the literature, this time is named the maximum allowed time to transfer an image (D m ). To this end, the time overhead should be minimized. The overhead of transmission can be resulted due to several factors such as propagation delay (τ Pr ), the MAC layer latency (τ MAC−SS ) due to the internal competition of secondary nodes, the delay caused by the spectrum sensing (τ SpectrumSensing ) [74][75][76][77][78], the delay caused by the retransmission (τ Retransmission ), and the delay resulting from Negotiation/Agreement process between two cognitive nodes (τ N ). Therefore, the total delay can be written as follows: where τ MAC−SP is the delay caused by the competition between the secondary and primary nodes to occupancy of channels with an emphasis on the higher priority for the primary network users (PUs). We write it as below: Given the fact that the air interface between the cognitive sensor nodes and the cognitive coordinator are assumed as a short-range line of sight, we assume that the delay caused by the propagation is negligible (τ Pr = 0). In addition, based on the assumption that M (the number of cognitive senders with is limited in a cluster and can be even lower than the S which is the number of sub-channels (M ≤ S), the delay caused by τ MAC−SS , also can be ignored. This is one of the assumptions of our proposed model.
In our proposed MAC layer, a Common Channel (CC) is considered for dialogue between the cognitive transmitter and receiver nodes. Each time that a spectrum sensing process is executed, the spectrum pool including the S empty channel can be detected and ranked. Then, the decision that has made on the selected optimal channel (C j ) along with the sender and receiver identifiers should be delivered to the receiver node. The receiver, subsequently, should whether acknowledge or disapprove it to the sender (based on the channel situation on the receiver side). Since both the number of channels (S) and the number of transmitter nodes (M) are limited, the data needed to conduct the negotiation between two nodes will be negligible in comparison with the massive amount of the video stream (τ N = 0). As a result, we consider the total time delay overhead as follows: When a collision occurs in the network, the sender should retransmit its last packets. This reduces the successful transmission probability of an input image within the maximum allowed time window (D m ). The imposed time overhead due to retransmission depends on the length of the packet has been lost in the last transmission. If the length of the packet is high, the latency will be high (and vice versa), but the important point is that lowering the packet length may reduce the delay due to retransmission, it also means that because of lower packet length it will result in more spectral sensing (SS) iterations. This exactly means that the time span of spectral sensing will increases. Therefore, there should be a tradeoff between the packet length and the number of spectral sensing iterations. In most of the works that have been done, the reduction of the spectrum sensing time window (T S ) is considered as the main and straight idea to reduce the spectrum sensing overhead time [63,79,80]. The important problem with these methods is that although any decrease in T S may lead to a spectrum sensing overhead reduction, in practice, both P FA and P CD fall and consequently both probability of successful transmission and throughput will decrease [81]. So, in this work, we proposed the idea of Joint Optimizing the Packet Size (τ P ) and the Number of Spectral Sensing Iterations (NSSI or X), and we named it JOPSS. In fact, in our proposed JOPSS method, the goal is to minimize the average time spent on retransmission and the spectrum sending sensing time.
For this purpose, the optimal packet size (τ P ) and the optimal number of spectrum sending iterations (X * ) are estimated simultaneously based on the proposed model.

Primary and Secondary Users Behavior Models
In this work, similar to existing works in [68,72,73,82,83], it is assumed that the time distance between PUs arrivals has an exponential distribution with the mean µ i (i is the channel number). Therefore, the arrival of PUs in the channel i has a Poisson distribution at the arrival rate In order to prevent the degradation of the primary network quality of service (QoS), the secondary nodes must perform SS before any transmission, and only send the channel when it is in IDLE state and recheck the status of the current channel during the sending process at specific times. In the case of a primary user arrival, the SU node should execute the handover operation (HO) from the current channel to release the channel capacity for an arriving PU. Additionally, all sensors are assumed to be equipped with a single interfaced module that can be switched between the existing S traffic channels as well as a common channel (CC). Here, it is assumed that the transmitter node always has a stream of images from its camera ready to be sent. Each image frame has I b = r × c × d bits in which r is the number of rows in an input image, c the number of columns, d is the number of sub color channels and n is the depth of the bit (in our simulations, these parameters are considered to be 512, 512, 3, and 8, respectively).

The Structure of the Proposed Model for the Delay-Sensitive Data Transmission
In delay-sensitive data transmission applications such as image and multimedia communications, time constraints are the most challenging issue. In this work similar to [72,73,83], we have defined D m as the maximum allowable time to send an input image. Therefore, a successful transmission is one that an image packet including I b bits and transmission rate R b are fully transmitted within [0, D m ].
In our proposed JOPSS method, the goal is to minimize the average time spent on retransmission and spectrum sensing. Given the Equation (3), time overhead τ OH is a function of spectral sensing and retransmission events. Any increase in the packet length may increase the probability of collision in the current channel, so retransmission can occur with a higher probability. Since in the retransmission, the re-larger packets should be transmitted again, the delay may significantly increase. But if the interference does not occur, the longer packet means that the time overhead due to spectrum sensing will be fallen.
On the other hand, a packet length reduction means reducing the possibility of interference. Also in the event of interf erence, smaller packets should be resent, which means that the effect of retransmission in the overhead delay is reduced. But unfortunately, in this case, the time overhead due to spectrum sensing is much greater than before because of calling the process in shorter times. Therefore, if similar to the existing work in this field, only the packet length is defined as the optimization variable, it will not satisfy the high performance needed. For this purpose, we jointly extract the optimal packet length ((τ i P ) * ) and the number of spectral sensing iterations (X * orNSSI) in our proposed model. Finally, we use the peak signal-to-noise ratio (PSNR) criterion in the receiver to evaluate the quality of receiving images. Table 3 lists all parameters of the proposed MAC layer model with their descriptions. In our model, τ i P is the packet length in i'th channel, and taking into account the time T s as a SS time, the time required to send each packet will be equal: t i P = τ i P + T s Table 3. List of parameters that were used in the proposed Media Access Control (MAC) layer.

The Average Time Overhead Due to Retransmission
To estimate the average time overhead due to the retransmission, the user arrival model must be applied. Considering the Poisson arrival model with the arrival rate λ p for primary users and subsequently taking into account the time interval exponential distribution, the probability function P(X i ≥ x) is expressed in terms of the following Equations (4) and (5) [60,72,84,85]: So it can be written as Equation (5) [60,72,84,85]: If we have X i transmissions is in the i'th channel, then the Actual Transmission Time in the channel t i ATT , is equal to X i t i P that we should have: t i ATT ≤ D m and t i ATT ≤ τ I where τ I is the time it takes to transfer I b bits at the rate R b in an ideal channel. Given the Equation (3), we want to evaluate the weights of both parameters T s and τ i P on the total overhead time. For this purpose, we consider the probability function P PU,X Ar (X i ) as the probability of a secondary user arrival in X i th iterations: Based on this definition, if a PU arrival does not occur during the sending of the packet, the time overhead on the channel is just related to the spectrum sensing and will be equal to X i T s while if the new spectrum sensing process detects a PU arrival into the existing channel "i", then the last packet will need to be retransmitted. The latency in this state is equal to X i T s + τ i P . According to the presented description, the overhead time of spectrum sensing and retransmission for the current channel can be modeled as follows: With consideration P PU,X Ar . Now, we should estimate the average of time overhead: According to the Equation (8), we need to extract the relationships for E(X i ) and E(g(t i P , X i , λ i , P f a , T S )) . In the following, we find the mathematical equation for E(X i ): So we can write Equation (9): Then, we continue to fine the E(g(t i P , X i , λ i , P f a , T S )): Now, we can write Equation (10): Ultimately, based on all proofed formulas from Equations (8)-(10), we demonstrate our extracted Equation (11): As a result, we have achieved the important formula that describes weights of both SS and Retransmission on the time overhead. These weights are L i for them, respectively. In Figure 2, assuming the fixed number of the spectral sensing iterations (NSSI = X = 3), the curve of the mean time overhead ETOH = E(τ i OH ) due to the retransmission and the spectral sensing, is plotted in terms of the packet length (τ i p ). As this figure, the average amount of overhead is low for small values of packet time (τ i p ). The reason is that the smaller τ i p is equivalent to the more frequent spectrum sensing. Therefore, the time overhead will be more due to the spectrum sensing. Now, if its value goes up from the minimum point at τ i p = 0.023 s, the time interval between spectral sensing runs will increase but in the case of interference, it means that a longer-length packet should be retransmitted. Thus, increasing the packet size can magnify weigh of retransmission side effects on the total time overhead in comparison to the SS. In the following, Figure 3 shows the effect of variations X on the value of E(τ i OH ). In this figure, with the assumption that the packet length is constant (τ i p = 0.001 s), increasing X will lead to an increase in the average time overhead. In the following, we plan to examine the effect of variations in the SS time on the mean time overhead. As shown in Figures 4 and 5, when T S is increased the average overhead time will be increased as well.

Defining the Average Effective Transmission Time
In the following, we intend to estimate the average Effective Transmission Time (ETT), E(τ i ETT ). For this purpose, we first define τ i ETT in the same way according to the Equation (12): With a little simplicity we can write the Equation (13): The average packet transmission time E(τ i ETT ) should now be computed based on the Equation (14): Using the extracted Equations (9), (10), (13) and (14) we can note the Equation (15) as below:

Proposed Objective Function
It is desirable to E(τ i ETT ) be maximized so that the transmitter node has the highest transmission in the current channel. However, the system's performance must be such that the average time overhead E(τ i OH ) is also minimized. In order to jointly maximize E(τ i ETT ) and minimize E(τ i OH ) , we define the objective function f as a ratio of these two functions as indicated in Equation (16): So we can write Equation (17): By replacing the Equations P * f = (1 − P f ) and L i = (1 − P f )e −λ i t i P applying the constraints related to the problem variables, the final mathematical presentation of our proposed optimization model is obtained as follows: In the following, Figure 6 shows the changes of E(τ i OH )/E(τ i ETT ) in terms of X and τ i p in two subfigures with considering all parameters and restrictions in the Equation (18).

The Proposed Algorithm for Delay-Sensitive Data Transferring
By solving the proposed Equation (18), unknown variables {X * , (τ i p ) * } can be estimated by the transmitter node. Then it considers the length of its packet to be equal (τ i p ) * and sends it. After that, it runs the SS again to check the status of the current channel. If the channel is still free, it will send the second packet with the same time. This procedure can be continued until completing (X * ) th packet transmissions (providing that no arrival occurred during the transmission time). At that time, the transmitter node attempts to release the current channel and switch to a new alternative channel, even if the current channel is Empty. This is called Proactive Hand Off or PHO. If the current channel has been occupied by the user before the actual X * transmission, then an HO should be made in a reactive or mandatory manner (MHO). In the following, our mentioned algorithm is well presented in Figure 7. In the proposed model, to reduce the computational overhead, the operation of updating the model parameters is defined in accordance with the following two specific events: PHO and MHO. We have named our proposed Dynamic Parameter Updating Procedure as DPUP method and its details are given in the Algorithm 1.

The Proposed Method for Channel Ratings and Optimal Channel Selection: MOST
At the sender node, before sending the packet with an estimated length (τ i p ) * , the MAC layer submits the request for the SS process to the physical layer. Here, it is assumed that the SS module in the physical layer is based on the energy detection approach (ED). Assuming AWGN channel, the received signal in the receiver in the case that channel is busy by a SU (H1 mode) is y(n) = s(n) + w(n). If there is no sending (H0 mode), the observed signal in the channel will be y(n) = w(n). In this regard, w(n) is the Additive White Gaussian Noise (AWGN) with a zero mean and variance σ 2 w . In the ED spectrum sensing method, N samples are gathered from the channel, then the decision criterion M is calculated as the energy of the recorded samples (M = Σ N n=1 |y(n)| 2 ). To evaluate the performance of the energy detector, two probabilities are used: P d (probability of detection) and P f (probability of false alarms). These two probabilities are defined as follows: In this work, we consider P d = 1 and P f = 0.01. When the physical layer performs spectral sensing based on energy detection, assuming that the channel is not saturated, S empty channels (not occupied by the primary users) are detected. In order to insure the channel not to be saturated and to provide service to secondary users, we need to have Mτ on < S(τ on + τ o f f ), where M is the number of primary users (PUs). PUs traffic is expressed by an exponential distribution with arrival rate λ i , average ON state τ on and OFF state τ o f f . Additionally, the sender sensor node is assumed to be equipped with a single interface module that can switch opportunistically between the S traffic channel and also a CC common control channel. In order to increase the efficiency of the communication channel, the sender sensor node should have the ability to rate this S channel and select the best sub-channel for sending. To this end, we propose the following method in which the channel with the minimum overhead time E(τ J OH ) is selected as the best channel. We named this channel selection method as MOTS (Minimum of Overhead Time Selection).
In this way, the optimal sub-channel (J * ) (1) is achieved using Equation (22): Subsequently, the second optimal sub-channel is also obtained found on the Equation (23): The rest channels of the pool are ranked accordingly based on the proposed method. As a result, the transmitting node has knowledge about all available channels with their priorities ({(J * ) (1) , (J * ) (2) , . . . (J * ) (s) }). The obtained data is named Sorted Channels Information (SCI). In fact, the proposed algorithm tries to enhance the system performance by engaging the channel with the least average time overhead.

Channel Negotiation Process between the Sender and Receiver
Another problem that still remains is that the sender cannot decide alone on the final channel because the peer receiver does not necessarily have access to all of these detected channels ({(J * ) (1) , (J * ) (2) , . . . (J * ) (s) }). To solve this problem, the architecture of the proposed MAC layer has been designed so that SUs can use the common control channel (CCC) to create an agreement (between a pair of secondary transmitter and receiver) on one of the available S traffic channels which were listed before. This MAC algorithm is deployed to solve this problem in order to negotiate the final traffic channels between SUs. With these explanations, the proposed channel negotiation mechanism is abstracted as follows: 1.
The node n Tx who has the data to be sent in its transmission buffer implements the spectrum measurement algorithm and finds the best empty traffic channels, SCI = {(J * ) (1) , (J * ) (2) , . . . (J * ) (s) }, in accordance with the proposed algorithm.

2.
n Tx is set up on the common control channel (CCC) and measures the carrier. If it is busy, it runs the backoff mechanism and waits for a random time.

3.
After finding out the idle channel, it waits for the completion of the distributed inter frames space so called DIFS interval. Then, it attempts to send the "request to send beacon" (C − RTS).
In C − RTS, in addition to transmitter and receiver identifiers (n ID Tx and n ID Rx ), information on spectral sensing and SCI = {(J * ) (1) , (J * ) (2) , . . . (J * ) (s) } with the header H and footer F are sent as follows: While the receiver node, n Rx , completes receiving the C − RTS beacon signal, it begins to inspect its channel access status which can take T S seconds. After this time, the node n Rx will gain the necessary information about the current status of the channel from its point of view. Now, with applying the MOTS algorithm, it is capable to select the best available channel, (J * ) (k) , which is in common with the peer sender (n Tx ).

5.
To confirm the channel availability, n Rx should send the C − CTS beacon to the n Tx after the expected time, so named short interframe space (SIFS ). The C − CTS is defined as below: When the node n Tx receives the C − CTS from the n Rx , it also will tune itself to the admitted channel ((J * ) (k) ). 7.
At this moment, both the sender and receiver nodes have been set up on the negotiated channel, (J * ) (k) , for data transmission. At the final step, n Tx waits for DIFS and then it will transmit its data frame with length (τ i P ) * with X * iterations (recalling the description given in the previous section) on the admitted channel ((J * ) (k) ) According to the described procedure, the negation time between two nodes, τ n , can be written as below: Due to the fact that the number of channels and the number of secondary users are limited, the CTS and RTS frames will have only a few bytes of data. On the other hand, the DIFS and SIFS frames are also very small, therefore in comparison with very large image data, it can be discarded. Subsequently, in this work, we did not consider the overhead of negation in our model.

Performance Evaluation Metric for the Proposed Image Transmission Model
There are a lot of image processing approaches to enhance quality of images and videos [32,[86][87][88][89][90] but at the first, its metric should be defined. Now, well-known metrics for assessing the quality of images and videos are VQM (Video quality measurement), PVQM (Perceptual video quality measure), MPQM (Moving picture quality metrics), SSIM (Structural Similarity Index), MSSIM (Mean SSIM), FSIM (feature-similarity), PSNR (Maximum signal to noise ratio), and HVS (human visual system) [85,[91][92][93]. Human Visual System (HVS) based techniques for IQ assessments (IQA) take benefit of some known characteristics of Human Visual System in order to incorporate perceptual image quality metrics (IQM). In [94], Venkata et al. developed a Distortion Measure (DM) and a Noise Quality Measure(NQM) for quantifying the effect of frequency distortion and noise injection on the HVS. Universal Quality Index (UQI) was introduced also to perform image similarity measurement successfully across distortion types. The main problem for these methods is that these are time consuming methods that strongly depend on human expert expertise and may vary from one to another.
Quality of image (IQ) is usually assessed using image quality metrics such as SSIM, HVS, MSSIM and FSIM along with PSNR and MSE but unfortunately, most of used metrics cannot describe the visual quality of the enhanced digital image adequately. Even though a number of image enhancement techniques are available, development of a quantitative enhancement measure suitable for all types of images, is still a challenging area and newer metrics are being thought of every day [93,95]. In fact, there is no universal measure, which specifies both the objective and subjective validity of the enhancement for all types of images [93].
In compression and transmission of digital images, sometimes very least changes may be desired and some famous metrics such as PSNR, MSE, and etc. are deployed widely as quantitative and public metrics for evaluating the amount of image signal distortion with respect to the given (original) image. Despite the multiplicity of quality measurements of images, the PSNR method is still used as the dominant method due to the ease of implementation and the frequency of deployment in other works [84,85]. Therefore, similarly, PSNR has been used mainly in our paper to measure the performance of the proposed system for transmitting images via cognitive radio networks but some others are also evaluated.
To calculate the PSNR, the average squared error must first be calculated. For this purpose, with the image stored in the transmitter buffer, I Sender (x, y), as well as the final received image at the receiver, I Receiver (x, y), we can calculate the mean squared error (MSE) using the Equation (25): Now, with the calculated MSE, the maximum signal-to-noise ratio (PSNR) is obtained from the Equation (26): where in the last equation, n is the depth of the bit. In this work, along with the PSNR, we also used the visual Error Energy (EE) criterion. The error energy is actually an image whose pixels are absolute difference between the pixels in corresponding channels in the transmitted and received images. This criterion provides an appropriate visual presentation of the quality of received images.

The Proposed Method to Improve the PSNR: SAFE Method
In the proposed MAC model, we urge to minimize the average time overhead due to both spectral measurement and retransmission. With this aim, the probability of successful transmission of an image within the allowed time domain ([0, D max ]) can be raised. If arrival rates of the PUs increase, the probability of collision will be higher. In this condition, retransmission of packets also enlarges and consequently, the number of iterations that needed for spectral sensing goes up. This means that some parts of the image, where were saved in the sending buffer, do not get the opportunity to be sent. In this case, depending on what extent the packet loss rate (PLR) is, the amount of PSNR can be greatly reduced. Zero-padding is an approach that the receiver runs when data loss occurs in the receiving image. Although there are several methods such as filtering and smoothing the image to increase the PSNR, in this case in which multiple consecutive rows of input image were lost, they are not effective approaches. Here, conventional methods not only are not effective but also they can even lead to further reduction of the PSNR. To improve PSNR, our proposed algorithm which is called Scrambling and Filtering based Enhancement (SAFE) is added to solve the issue at the sender instead of the receiver. So, we first rearrange all the pixels within the image in the transmitter before sending it. After receiving the image in unordered pixels, we reconstruct it and apply a 3 × 3 smoothing filter to make it smoother. The proposed algorithm is as follows in Algorithm 2. Now, having data available to send, the transmitter runs SS and selects the best channel calling the proposed MOTS method. Then, it recalls the proposed JOPSS method to choose the optimal values for both packet length of and number of iterations, {X * , (τ i P ) * }, simultaneously. The transmitter gets D S , splits it to multiple frames with (τ i P ) * size and sends X * packets with this size. The procedure will be continued until the transmission of the last bit before the timeout event.
In the receiver, D * S is received and it will be ideally D * S = D S , but due to interference and the timeout , some pixels were missed. The receiver is capable to make the image (Î) * from D * S and reconstructing the image I * Sender by applying the transfer function T −1 g(x,y) to the obtained image (Î) * : Ultimately, the receiver can interpolate and modify the amount of each pixel with 8 adjacent pixels by applying a 3 × 3 smoothing filter. Found on the proposed SAFE method, the consecutive rows of black pixels, which resulted from zero-padding the last sub channel of the image due to missed data, are distributed in all sub channels (instead of just one channel). As a result, a noticeable improvement can be achieved. More details are discussed in Section 4.

Simulations and Results
In Section 3, our constructive MAC layer was presented for streaming images in time-restricted applications. In this section, experimental results achieved in our implementations using MATLAB are demonstrated.

Simulation of the Proposed JOPSS Model
This section examines the performance of the proposed cognitive radio MAC layer for transmitting the image of a thermal camera on a wind farm. For this purpose, the parameters of the model described in Section 3 have been initialized as T S = 0.01 s, D m = 1 s, S = 1, and I b = 6, 291, 456 bit. Now, we increase the arrival rate from 2 arrivals per second (APC) to 40 APC (λ i = [2,5,10,20,40]). Figure 8 shows the NSSI in terms of the arrival rate while Figure 9 depicts the length of the packet. In these two figures, a comparison between the simulation and the estimation is shown. As evidenced in these figures, when the arrival rate of PUs is growing, the algorithm intelligently urges to raise the NSSI and decrease the length of the packet. In fact, the algorithm behaves well to reduce the probability of interference at higher rates.  For example, at the low arrive rate λ i = 2 (arrivals per second (APS)), the algorithm selects a large packet with the length τ i P = 64,040 µs and the NSSI = 9. With these values, 87% of the data stored in the transmission buffer are sent in the first attempt. The remaining data only require 105,566 µs time to be sent in 9 − 1 = 8 available iterations while the timer overflow occurs 253,879 µs later. This means that 13% of the input image that is still waiting to send have enough time for successful transmission within the allowed time (D m = 1). In comparison, for λ i = 40 APS, our algorithm tries to decrease the packet length to τ i P = 7731 µs and increases the NSSI from 9 APS to 47 APS to avoid overhead due to both SS and retransmission of large packets. In this condition, only 57% of the input image was sent after the first try. In order to fulfill transmission of this image, it is required 625,969 µs time so about 33% of pixels were missed because of the timeout. In the following, it is intended to evaluate the behavior of the function E(τ i OH ) as a mean time overhead. For this purpose, the value of τ i P is increased from approximately 0 to 0.1 s. For this purpose, three different values are considered for the NSSI which are 1, 4, and 22. Among these values only NSSI = 22 was estimated by the proposed algorithm JOPPS, others were selected for making a comparison. In Figure 10, the comparison between the expected value of overhead time (E(τ i OH )) for different NSSIs. As it can be seen, the JOPSS suggests NSSI = 22, and τ i P = 0.0242 s which accordingly the average time overhead will be about E(τ i OH ) = 0.0337 s. In this figure, the values of E(τ i OH ) for NSSI = 1 and 4 and are 0.01 s and 0.028 s, respectively. It sounds the JOPSS has suggested an inappropriate value while If we calculate the percentage of successfully sent packets for these three different values, we discover the truth that for NSSI = 1 the overhead time is much less (E(τ i OH ) = 0.01 s) but only 1% of the information (an input image) were successfully sent before the first hand-off, and this number is about 8% for NSSI = 4. To comparison, it is about 75% of the input image in just first try for NSSI = 22 as the optimum value that was selected by our algorithm. This is a testament to the ability of the JOPSS algorithm to select the optimum values for NSSI and τ i P values, jointly. In the following, we plan to investigate the performance of the proposed MOTS system for channel ranking and optimal channel selection.

Performance Evaluation of the MOTS Method for Channel Rating
To check how the MOTS method works, the values D m = 1, T s = 0.01, P f a = 0.01, S = 10 have been applied in simulation. In the following, three different scenarios are defined for this purpose: [3,6,9,15,20,25,40,50,80,100] λ (2) = [100, 80,50,40,25,20,15,9,6,3] λ (3) = [15,15,15,15,15,15,15,15,15,15] In the first scenario, the PUs arrival rate vary from 3 APS (in sub-channel with channel number index (CNI) equal to 1 (CNI = 1)) to 100 APS (for CNI = 10). In Figure 11, an effectiveness evaluation of the proposed algorithm MOTS on channels contribution to data transfer in three different scenarios is presented as a histogram. In this figure, the horizontal chart contains a sub-channel number (CNI), and the vertical axis represents the number of times that a sub-channel was involved in sending data during the allowed time. As shown in Figure 11a, in the scenario (1), sub-channels 1 through 3 with 14, 12, and 6 repetitions were selected by the MOTS in the transmission of information, respectively. In this scenario, the algorithm intelligently prevents involving channels 4 through 10, which have high arrival rates. Consequently, these channels have no share in the data transmission.
In the second scenario, the channels are reversed. In this new case, the MOTS has successfully managed to share just suitable channels during the transmission. Here, sub-channels 10, 9, 8, and 7 were involved in data transmission. sub-channel 9 as the most active channels with about 30 iterations carried almost 43% of transmission while sub-channels 10, 8, and 7 share 35%, 19%, and 3%, respectively.
In the last scenario, all channels have the same arrival rate (λ i = 15, i = 1, 2, . . . , 10). In this experiment, the proposed algorithm has struggled rigidly to distribute data uniformly in a balanced way across all sub-channels. In Figure 11c, 80% of all available channels were deployed in data transmission. The third sub-channel, as the most active channel, was repeated four times while channels 2 and 10 were idle during the transmission. Comparing the results of the three different scenarios shows that the proposed algorithm had tried to only transmit the channels that have the best conditions.

Performance Evaluation of the Proposed Model Found on PSNR Comparison
This section analyzes the result of sending images based on the proposed JOPSS MAC layer. For this purpose, at first, it is assumed that D m = 1s and S is equal to 5. Considering the arrival rates λ = [1, 6,12,18,100] for the PUs and running this scenario, the results of Figure 12 are achieved. This figure compares the thermal camera output image (in RGB) in the transmitter and receiver as a successful transmission. As shown in the figure, the error energy for the color image is zero. This means that MSE = 0 and consequently the PSNR is infinite. Now, with a decrease of D m from 1 s to 0.7 s, we deliberately provide conditions so that the overrun of the timer occurs. Figure 13 shows the comparison of transmitted and received images in an unsuccessful transmission. In this case, the whole image is not sent within the allowed time range, and about 36% of the image remains in the sender's buffer (whole of a sub color channel plus some pixels of other sub-channel). This has led to PSNR about 21.5 dB. In addition, Figure 14 compares the transmitted and received color images in an unsuccessful transmission. Due to the fact that all below the blue channel image was lost, in the image restored in the receiver, there is no information about the blue background of the original image, and the error energy image is also dominated by the blue color (Figure 14c).
Finally, we plan to evaluate the effect of applying the proposed SAFE method on the improvement of the PSNR. We run again an unsuccessful transmission experiment with and without adding the SAFE algorithm. In Figure 15, the result of applying SAFE method can be observed. In this figure, the missing pixels which were 21% of the image are distributed well throughout the sub images. The error energy comparison in Figure 15b shows that lost pixels are well distributed throughout the image sub channels. Accordingly, the PSNR is improved to around 27.4 dB using SAFE. Figure 16 also shows the comparison of the reconstructed color image with its error energy in normal sending (without SAFE) and sending with the SAFE algorithm.  Table 4, the comparison of PSNR is presented for the proposed method and other available techniques. It should be noted that in this table results were obtained using 1000 repetitions and finally the average PSNR were calculated for the sample image depicted in Figure 12a. The results clearly show that the proposed JOPSS model increased the image PSNR on average 3.2 dB while the JOPSS-SAFE model can even enhance it about 8.2 dB. In order to draw a wider evaluation of our proposed algorithm, Tables 5 and 6 are presented. In Table 5 some important IQA metrics such as SSIM, MSSIM, FSIM and PSNR are compared using our proposed JOPSS model. This table indicates that JOPSS is capable to achieve well outcomes under different performance metrics. SSIM gives IQA from pixel based stage to a structure based stage while FSIM is used to understand images mainly according to low level features. It gives good prediction capability, higher accuracy and robust so in Table 6, we compare our algorithm with [52,72,96] based on FSIM. The obtained results show that JOPSS outperforms other existing approaches not only in PSNR but also in FSIM.

Conclusions
In this paper, due to the importance of intelligent monitoring, inspection and maintenance technologies in emerging smart grids, a special architecture for image streaming in wind turbine farms was presented based on cognitive radio networks (CRNs). We presented the designing of a customized cognitive radio MAC layer for bulky and delay-sensitive data transmission. In the proposed model, the idea of minimizing time overhead due to both retransmission and SS time, without reducing SS time, was presented well. The distinctive feature of our model is that unlike similar methods in the literature, we did not insist on reducing spectral sensing time. The reason is that although it seems any reduction in SS time can reduce the time overhead caused, actually it will increase the false alarms and also miss detection probability. This means lower channel efficiency and quality of service (QoS) are not avoidable. Therefore, we targeted joint optimization of number of spectrum sensing iterations (NSSI) and the packet size, as two main optimization parameters, using our JOPSS model for delay-sensitive communications. To this end, we defined our proposed objective function as the quotient of the Overhead Time and the Effective Transmission Time (ETT) along with Dynamic Parameter Updating Procedure (DPUP) to benefit different strategies in Mandatory and Proactive Handoffs (MHO/PHO). Furthermore, in order to increase the system efficiency, we did not count only on the time overhead reduction. We also proposed the ranking procedure, MOTS, for the optimal selection of sub-channels during the image transmission. It forces the transmitter to select only sub-channels that impose the least time overhead during the transmission. Besides, in order to enhance the PSNR while missed pixels were accumulated at the end of the image, we presented our SAFE method based on the scrambling of the image in the transmitter and reconstructing it with applying smoothing filter in the receiver. It should also be noted that we conducted our implementation according to restrictions defined for bulk and delay-sensitive data transmission over smart grids in IEEE 1646 [29] and IEC 61850 [28] standards. The amount of PSNR achieved found on proposed methods JOPSS and JOPSS-SAFE are 29.67 dB and 31.79 dB, respectively. The achieved results indicate that the proposed algorithms outperform strongly other existing approaches based on both PSNR and FSIM metrics.
Today, Deep learning (DL) techniques get more attentions in computer network applications due to their excellent achieved results. In particular in resource allocation problems, DL has shown a tremendous impact in recent years. Therefore, we are going to replace the exhaustive search method used in our study with DL to reduce time cost of parameter estimation step in the optimization problem. Besides, due to this fact that different IQA metrics perform differently for various distortion types so fusion of these metrics would be a useful and practical suggestion found on machine learning and DL methods for future works.

Conflicts of Interest:
The authors declare no conflicts of interest.