Adaptive beamforming approach for secure communication in 5G network

: The beamforming approach has been emerging as a very important concept for next generation networks. In addition to the improved channel capacity, spectral efficiency, energy efficiency, secrecy rate and secrecy outage probability, the upcoming fifth generation network mainly aims at enhancing the parameters of the channel for secure communication. In this paper, we have implied the allocation of resource blocks adaptively using HMM with a beamforming approach in an intruded network. A system model for secure communication in an intruded network has been discussed using a beamforming approach with the main motive being to provide a security scenario to the data which is transmitted over an unsecured channel in a network. In addition to this we have used the approach of HMM for allocating the resource blocks to the users which have been demanded and applied in order to avoid the intrusion and wastage of resource blocks.


Introduction
From the last few years, wireless communication technologies have surged at a very challenging rate, therefore crafting advanced and new services at a minimal cost.This forth hence resulted in an increment in demands of the subscribers like high data rates, improved spectral and energy efficiency, secure communication and secrecy outage probability.The most efficient way to tackle this problem is the usage of spatial processing [1].Due to the increment in quality of subscribers and demands, there is a surge in the transmission quality and the coverage area, to fulfill these requirements smart antennas are used [2].Adaptive Beamforming Approach is emerging as an optimal solution for fulfilling the surging demands of the subscribers.For various platforms of mobile technologies for example laptops, automobiles and cellular phones, smart antennas are being used [3].Mostly the 3G systems operate in frequency bands of 3G Hz [2] and the 4G coins next stage of the cellular evaluation which do offer an efficient service of cellular technologies.This paper focuses on the algorithm which is required for Adaptive Beamforming in the radiation pattern of the antenna for secure communication.
It is an amalgamation of antenna arrays which do use the processors for digital signaling [4].This paper also represents the improved channel capacity, spectral efficiency, energy efficiency, Secrecy rate and secrecy outage probability depicted via graphical analysis.There are different projects regarding the secure communication in 5G are mammoet [1], MCN [1], MOTO [1] which hence coined in different parts of the world.Work is being done on these projects in different parts of the world for the improved security scenario.The Adaptive Beamforming Approach that has been used in this paper for secure communication depicts two cases for the projection of the beam that are; widening of beam and directivity.The results that have been depicted in this paper making a comparison study with and without using HMM which is used for adaptive allocation for resource blocks to the cellular users which have demanded the applications.A mathematical approach has been set up in this paper for coining different parameters of the network.

Background
The literature survey of more than hundred papers was conducted by me which motivated me to take a step further and do the work in this proposed scenario.This section essentially comprehends a survey of some of those papers which reflects the work that has already been done in the recent past in the field of security regarding wireless networks stating some of the recent technologies used.After the literature survey which has been done, it was very clear that security is the essential need of the hour.There is a growing need to adopt adaptive beamforming architectures in order to meet the increasing demands for improved capacity, higher data rates, higher quality of services and secured communication for the next-generation networks.
The emphasis on study of adaptive beamforming approaches started about two decades ago.Godara [5] suggested that there is a rapid growth in the communication technology which has led to increase in demands for higher data rate application with secured communication making adaptive beamforming approach all the more important.Different phenomena are included for securing the transmitting data.Han et al. [2] introduced the concept of cryptography into wireless systems for the transmission of data from base station to the users.Gandotra et al. [6] proposed an architecture for D2D WCN for a secured communication in which the users in the same proximity up to a certain distance will share the data hence reducing the probability of attacks.Ma and Tsudik [7] proposed the use of jamming technology in order to jam the signals from the attacker so that intrusion cannot take place and a secure communication of information can take place.From time to time the cell size, different techniques of cryptography, D2D WCN, resource block allocation, jamming techniques and beamforming techniques have been used for secure communication.
In the last decade, network deployment strategies have gained much attention including the focus on optimal cell size to improve the security scenario of a network.Claussen et al. [8] discussed the use of picocells and femtocells to decrease the path loss and improve the security aspect of the network and by improving the energy efficiency of the network.Derryberry et al. [9] proposed a new cellular architecture from optimal 3G network to adaptive beamforming network.Wang et al. [10] proposes separate architecture indoor and outdoor setups for 5G in order to facilitate the security aspects due to decreased path loss from the transmission by the indoor users.
Adaptive resource block allocation and beamforming has gained much attention in the past decade for securing the different scenarios of the different wireless communication networks.In the third-generation partnership project (3GPP) and longterm evolution-advanced (LTE-A) and IEEE 802.16j, beamforming standards have been detailed including the maximization of secrecy rate [11].But many issues are still not discussed up to this point.Hence the allocation of resource blocks to the three demanded applications is explained in.Gupta and Jha [1] proposed a new architecture regarding scaled beamforming Gupta and Jha [1] which hence is a modification to the zero-forcing beamforming.Nguyen et al. [12] explained the phenomena to maximize the secrecy rate by the joint information and jamming beamforming in cognitive radio networks.Chopra et al. [13] explained a new architecture for the security aspect in ultra-dense networks which hence was concentrated on the security issues of the physical layer [13].Alotalbi and Hamdi [14] posited the concept of analyzing secrecy outage probability in a cooperative network for non-identically distributed Rayleigh fading channel but independent [14].Zhang et al. [15] proposed a region-based beamforming for defining spatial secrecy outage probability.

Contribution
In this paper, our focus is on secure transmission of data in a Beamforming Approach for next generation networks.The system consists of a 5G network for D2D communication with Cellular users placed demanding for applications from Base Station.An Adaptive Beamforming Approach has been discussed in this paper for the security scenario in a network where applications are being demanded.
Secondly, in order to provide adaptive resource allocation of the subcarriers for the applications that have been demanded to all the nodes including the CUs, D2D pairs HMM has been used.The Hidden Markov model solves the allocation problem using a stochastic process and helps in training and maintaining of Base Station (BS), SCA and Relays based on various parameters and they in turn allocate power to their respective client nodes.The various parameters considered for power allocation are: node class, node distance, node SNR and application demanded by the client node.
Based on adaptive resource allocation and beamforming approaches we have proposed an algorithm for secure communication by decreasing the security issues.The second section contains a beamforming approach system model for secure communication for the next generation networks.It also provides a detailed mathematical analysis of the scheme adopted.Section 3 gives an account of the pseudo code of the algorithm used for secure communication with the flowchart used in the process.Section 4 embraces the imitation parameters cast-off and the exhaustive analysis of the results attained and the limitations related to the work.The supposition and the future research scope is debated in Section 5.

Secure communication scenario using beamforming approach
This section simply describes a system model and a mathematical analysis for secure communication of the next generation wireless network.

System model for secure communication
In a 5G Wireless Communication Network for a network of Device-to-Device communication where the applications are demanded by the cellular users from the base station.The three basic applications that can be demanded are data, voice and video from the base station.The resource blocks allocated to the respective user adaptively using HMM and adaptive Beamforming approach is implied further for secure communication after allocating the resource blocks to the users.Different parameters of a communication network like channel capacity, energy and spectral efficiency, secrecy rate and secrecy outage probability are coined and a comparison has been made for the performance of the network between security scenarios with and without using HMM for allocating the resource blocks to the cellular users.
For the secure communication adaptive resource block allocation with adaptive beamforming approach is applied.In the adaptive beamforming there are generally two cases i.e., • Broadening of the beam where a larger area is secured in an intruded scenario, the distance of the intruded users is less from the base station.
• Directivity of the beam where a narrow area beam is used for the secure communication to the user which is a little away from the base station, the SNR in this case is greater as compared to the previous case.Earlier the RBs allocated to the users demanding the applications equally which laid the probability of the intrusion in greater numbers.But in adaptive RB allocation using HMM, a probabilistic approach has been laid down for allocating the RBs according to the application which hence improves the security scenario and wastage of RBs.But the block size of the video application is still large in size which hence is laying the threat of intrusion.For removing the threat, adaptive beamforming approach has been implied for the secure communication of the data.The beam directivity is the phenomenon that has impinged in this case.After applying the adaptive beamforming approach different network parameters are coined for an optimal performance of the network.A comparison has also been made using and without HMM.

Mathematical analysis for secure communication
A mathematical approach for adaptive beamforming has been proposed for coining the different parameters of the network to analyze the performance of the communication network under intrusion scenarios in Figure 1.In this scenario, a consideration has been made for a communication network of 'R' radius where the BS is placed at the center allocating the RBs to the users which demanded the application by using HMM.
The channel gain taken between the cellular users as Gd,cu(b) and at base station, the gain of interference link from BS to a-th D2D pair as Ib,d(a), the interference link gain from a-th D2D pairs receiver to its CU be Id(a),cu(b).The transmitted power of the a-th D2D pair and b-th CU are depicted as Pd(a) and Pcu(b) respectively.The signal received at the BS of the CU and eavesdropper is represented by: where   and   are the received signal strengths at BS of cellular user and eavesdropper,  () and   are the transmission power from user and eves to BS,   and   are the impulse responses of the channel for user and eves,  ℎ   ℎ are the signal strength transmitted by user and eves.
Hence the channel capacity according to the Shannon's capacity will be: The SINRs of b-th cellular user and are stated as: is the noise variance and Rs' being the reuse component of RBs of the CUs.

Directivity phenomena
A directive antenna is used with varying beam-width for adaptive beamforming approach.For the mathematical proposal the gain of the directive antenna is considered as: is the gain function and  * is the beam-width The D2D pair set is d = {1, 2, …, D}.The Cellular user set is Cu = {1, 2, …, c}.The allocation of RBs to the CUs is done periodically as Rbs = {1, 2 ,3, …, r}.The transmission power is   * .The set of applications demanded App = {ap1, ap2, ap3}.
The iterations are considered as set q = {1, 2, …, Q}.At the receiver the SINR of the a-th D2D pair which is sharing k-th RB of b-th user, j ∈ d, k ∈ Rbs, i ∈ Cu, given for every iteration as: +   (7)   depicts the total interference that is encountered by the a-th D2D pair.Hence the SNR received by the eavesdropper will be: where  , =   −   .
Hence the channel capacity according to the Shannon's capacity will be: The spectral efficiency of normal channel expressed in bps/Hz and is calculated as: The spectral efficiency of intruded channel expressed in bps/Hz and is calculated as: The energy efficiency of normal channel expressed in Mbps/J and is calculated as: The energy efficiency of intruded channel expressed in Mbps/J and is calculated as: So hence the secrecy rate is stated as: In order to achieve a high desirable level of secrecy rate, physical layer security serves as the optimum solution.Hence secrecy outage probability is given by: where  1 ′,  2 ′ and  3 ′ are the code transmissions of data rates of U(1), U(2) and U(3).So hence the secrecy is maintained after adaptive resource allocation but due large size of the RB of the video application, so to protect the channel from being intrude the phenomena of beamforming will be applied.The signal received at the base station is represented by: The SNR will be: where  ,() * =  () * −   , h0 is the channel coefficient.
Hence the channel capacity according to the Shannon's capacity will be: The SINR of the b-th cellular users is: The SNR for the eve is: where  ,() =   *  −   , h0 is the channel coefficient.
Hence the channel capacity according to the Shannon's capacity will be: The spectral efficiency of beamforming channel expressed in bps/Hz and is calculated as: The Energy efficiency of beamforming channel expressed in Mbps/J and is calculated as: So hence the secrecy rate so obtained in this case is: Considering a network (AWGN) the eavesdroppers which are the adjoining will experience nominal path loss among the other eavesdroppers.Hence, the secrecy capacity will be determined with respect to the nearest eavesdroppers, such in that case the channel is greater than the given threshold Rc ≥ 0 which is hence referred as Secrecy Non-Outage Probability and given as:

𝛿 =
,  is the path loss exponent,   − is the distance between base station and cellular user,   − distance between base station and eves but there are many external factors with the intrusion attacks which does not support the SR and hence there is a decrease in the secrecy rate and hence that phenomena are called as Secrecy Outage Probability.
As to study the probabilistic approach for allocating the RBs to the different cellular users demanding the different applications for secure communication, Hidden Markov Model in this paper has been discussed.BS controls the scheduling of the CUs.The representation of the HMM is done by the set of parameters   ; set of states   [16].The representation of the state diagram as: The base station (BS) and cellular users (CUs).
The representation of parameters by the matrices of probability as , , .
Probabilities that are prior  hence giving the first state.Likelihood of the observation is represented by probabilities of emission [EP] and transition of one to another state is represented by the probabilities of transmission as [TP].The process of HMM is usually characterized by sequence of observation   = { 1 ,  2 , …   } and sequence of hidden state,   = { 1 ,  2 , … ,   }.The probability sequence of hidden states is a product of probabilities of transition.
Likelihood the observation sequence will be: Known prior to the RB allocation process is their observations.The set of applications demanded by App and their priorities are already known.Now by applying this phenomenon there is less chance of the spoofing of the data and voice RBs as due to small size resulting from adaptive resource block allocation.But still the RBs of video application is still under threat due to its large size.Hence here we can impinge the phenomena of beamforming.
As beamforming phenomena dedicate the beam of information from the base station to the user which demanded the application respectively.As there is deployment of multiple antennas at the base station and the application is demanded (video) via U(3) so hence there will be a dedicated beam projected.Earlier at the BS an omni-directional antenna was present for the allocation of the RBs but in this case, directive antenna is used at the BS for the RBs allocation and hence it results in difficulty for the intruder to eavesdrop the information.
The various parameters that are to be included via using the approach of HMM.The different parameters are as follows: • The number of nodes.

•
The types of nodes.

•
The type of applications demanded by the client nodes.

•
Resources blocks allocated to the client nodes.
Here in this scenario the resource blocks allocated to the respective user demanded the applications amongst video, voice and data adaptively.

Transition probability matrix for secure transmission of data
The HMM model used in this paper to depict the transition probabilities that the information is transferred from one CU to another according to the applications demanded by them.The subcarriers used for text and call are less as compared to video's subcarriers.
In the scenario for this paper, an adaptive resource allocation approach has impinged for the process of allocating the RBs to the CUs which demanded the application accordingly.The three users which are depicted as User 1, User 2 and User 3 demand data, voice and video applications as shown in Figure 2. The transition from one to another state is depicted in Table 1.The Adaptive RB allocation is useful for the secure communication and to avoid the wastage of the RBs.

Realization and representation of objective
In this section, the pseudocode of the presented scenario for secure communication in this paper has been mentioned as for the optimized performance of the network.
Pseudo code 1: for realizing the scenario for D2D communication and cellular networks (depicted in Figures 3 and 4).

•
Step Step 2: Specifying the Applications.
Applications should be specified in the descending order of priority.Avideo > Avoice > Adata • Step 3: Decide the number of RBs that should be allocated.Allocation of the RBs is preferred adaptively within concern to the applications that are demanded and their priority.The value of 'k' depends on the application that has been demanded.

•
Step 4: SNR and throughput computation which is based on the adaptive RB allocation.
Obtain the values of SNR and throughput from the trained data and distributed probability.
Pseudocode 3: for beamforming approach (in Figure 6) Step 1: Specifying the applications.Applications are specified in the descending order of the priority.Avideo > Avoice > Adata • Step 2: Beamforming Approach is applied for RB allocation.
In the approach of adaptive beamforming, a directive and dedicated beam of RBs is allocated to the cellular users demanding video application.

•
Step 3: SNR computation based on beamforming approach with respect to directivity.
Obtain the values of SNR from the trained data and plot the values by comparing them with earlier values.

Simulation parameters and results
This section of the paper contains the different simulation parameters to evaluate the performance of the different parameters of the network.After the RB allocation by using HMM, beamforming approach has been introduced with respect to adaptive approach which hence is used to enhance the performance of the network.The parameters used in our simulation are listed in Table 2.The results that are so obtained by obtaining and implying these values are with the help of MATLAB.Different parameters that have been checked in this paper are given as:

Channel capacity
The effect of use of a directive antenna and HMM at the Base Station is examined by analyzing the channel capacity, spectral and energy efficiency, secrecy rate and secrecy outage probability.As already stated, there is a random deployment of nodes in the wireless network which results in the formation of cellular users and D2D pairs at every instant.The users which do meet the proximity criteria are successful to form D2D pairs, while the rest of the users that remain unpaired, and hence do operate as the cellular users working in the cellular mode.A comparative study has been made for with and without using HMM.The number of cellular users deployed in the network is 50.
Figure 7 clearly describes the deployment of the cellular users and Eavesdroppers in a wireless communication network depicting that the network scenario proposed in this thesis around 300 m radius with the BS placed at the center (0,0) is under threat.The transmission of the data from the Base Station to the cellular users is intruded by different attacks prevailing in the wireless communication network.The comparison is made with the normal channel capacity, channel capacity when the eavesdropper attacks or intrudes the transmission of data from the Base Station to the cellular users that demanded the application and the channel capacity by using the beamforming approach with respect to the diversity with the maximum rate of 85 Mbps.By adapting the beamforming approach, we had an increased channel capacity as compared to the channel capacity of the normal channel and the values are depicted in Table 3.  Figure 9 clearly depicts the channel capacity analysis with the respective SNR using HMM.The comparison is made with the normal channel capacity, channel capacity when the eavesdropper attacks or intrudes the transmission of data from the Base Station to the cellular users that demanded the application and the channel capacity by using the beamforming approach with respect to the diversity with the maximum rate of 102 Mbps.By adapting the beamforming approach, we had an increased channel capacity as compared to the channel capacity of the normal channel and the values are depicted in Table 4.

Spectral efficiency
Figure 10 clearly depicts the spectral efficiency of the channel with respect to SNR.As we know that spectral efficiency is defined as the information rate that is to be transmitted over a specified given bandwidth for a specific scenario of wireless communication network.The main objective of this phenomena is to measure how efficiently a frequency spectrum that is limited, be utilized by physical layer protocol and somehow by media access control.In order to reach up to the desired requirements of high spectral efficiency, low latency, high reliability, high throughput; a combination of NOMA scheme and many other technologies.The figure describes the spectral efficiency analysis with SNR.The comparison has been made with the normal channel spectral efficiency, spectral efficiency of the channel after the attack or intrusion and the spectral efficiency of the channel applied with the beamforming approach.The values in this process are measured in bps/Hz.By adapting the beamforming approach, we had an increased spectral efficiency as compared to the spectral efficiency of the normal channel and the values are depicted in Table 5.  Figure 11 clearly depicts the spectral efficiency of the channel with respect to SNR using HMM.As we know that spectral efficiency is defined as the information rate that is to be transmitted over a specified given bandwidth for a specific scenario of wireless communication network.The main objective of this phenomena is to measure how efficiently a frequency spectrum that is limited, be utilized by physical layer protocol and somehow by media access control.The figure describes the spectral efficiency analysis with SNR.The comparison has been made with the normal channel spectral efficiency, spectral efficiency of the channel after the attack or intrusion and the spectral efficiency of the channel applied with the beamforming approach.The values in this process are measured in bps/Hz.By adapting the beamforming approach, we had an increased spectral efficiency as compared to the spectral efficiency of the normal channel and values are depicted in Table 6.

Energy efficiency
Figure 12 clearly depicts the energy efficiency of the channel with respect to SNR.As we know that energy efficiency is defined as a simple approach which describes how efficiently the energy can be utilized in order to preserve the energy in a network.The main objective of this phenomena is to measure how efficiently the energy in the network can be preserved for increasing the life of hand-held technologies.

Figure 12. Comparison of energy efficiency and SNR.
The figure describes the energy efficiency analysis with SNR.The comparison has been made with the normal channel energy efficiency, energy efficiency of the channel after the attack or intrusion and the energy efficiency of the channel applied with the beamforming approach.The values in this process are measured in bps/J.By adapting the beamforming approach, we had an increased energy efficiency as compared to the energy efficiency of the normal channel and the values are depicted in Table 7. Figure 13 clearly depicts the energy efficiency of the channel with respect to SNR using HMM.As we know that energy efficiency is defined as a simple approach which describes how efficiently the energy can be utilized in order to preserve the energy in a network.The main objective of this phenomena is to measure how efficiently the energy in the network can be preserved for increasing the life of handheld technologies.The figure describes the energy efficiency analysis with SNR.The comparison has been made with the normal channel energy efficiency, energy efficiency of the channel after the attack or intrusion and the energy efficiency of the channel applied with the beamforming approach.The values in this process are measured in bps/J.By adapting the beamforming approach, we had an increased energy efficiency as compared to the energy efficiency of the normal channel and values are in Table 8.

Secrecy rate
Figure 14 clearly describes the secrecy rate with SNR.Secrecy rate is actually a measure that how secretly the data is transmitted over a channel.Secrecy rate is calculated with the channel capacity of the channel before and after the intrusion.The comparison of the values is depicted in this figure for the secrecy rate analysis of the normal channel and the secrecy rate analysis of the beamformed channel with respect to the diversity approach.Hence from the above results gained from the comparison, it can be concluded that by adopting the beamforming approach increases the secrecy rate of the channel and hence diversity is the phenomena which is the main component for the high secrecy rate in the channel.

Figure 14. Comparison of secrecy rate and SNR
Figure 15 clearly describes the secrecy rate with SNR using HMM.Secrecy rate is actually a measure of how secretly the data is transmitted over a channel.Secrecy rate is calculated with the channel capacity of the channel before and after the intrusion.The comparison of the values is depicted in this figure for the secrecy rate analysis of the normal channel and the secrecy rate analysis of the beamformed channel with respect to the diversity approach.Hence from the above results gained from the comparison, it can be concluded that by adopting the beamforming approach increases the secrecy rate of the channel and hence diversity is the phenomena which is the main component for the high secrecy rate in the channel.

Secrecy outage probability
Figure 16 describes the concept of secrecy outage probability and the comparison in the values of the theoretical concept proposed earlier and the values of the proposed scenario in this thesis.As known, there is a least value of channel capacity that decreases from that specific value, the probability of non-secure transmission of data is possible.Hence this phenomenon is defined as secrecy outage probability and for a secure communicative network, the SOP should be decreasing with SNR.Hence this figure clearly depicts the comparison between the SOP of the already stated theoretical scenario and the proposed scenario stated in this thesis with SNR.As this figure describes, the values of SOP of the proposed scenario in this thesis are lower as compared to the theoretical scenario which is hence required from this phenomenon.Figure 17 describes the concept of Secrecy outage probability and the comparison in the values of the normal channel and beamforming channel using HMM in this thesis.As known, there is a least value of channel capacity that decreases from that specific value, the probability of non-secure transmission of data is possible.Hence this phenomenon is defined as secrecy outage probability and for a secure communicative network, the SOP should be decreasing with SNR.Hence this figure clearly depicts the comparison between the SOP of the already stated theoretical scenario and the proposed scenario stated in this thesis with SNR.As this figure describes, the values of SOP of the proposed scenario in this thesis are lower as compared to the theoretical scenario which is hence required from this phenomenon.
In this paper, by using HMM with Beamforming approach a high secrecy rate has been achieved in order to avoid intrusion and wastage of resource blocks.From the results that are analyzed from the proposed concept, it is observed that in comparison to the existing scenario, a considerable improvement in channel capacity, spectral and energy efficiency and secrecy rate and decrease in secrecy outage probability obtained with the proposal made in this thesis. .Such high values of channel capacity, spectral and energy efficiency and decrement in secrecy outage probability are what actually are targeted by the 5G networks and are highly desirable to meet the rising subscriber's demands.
• Limitations This research is limited by basic drawbacks of adaptive beamforming; the robustness is lost if there is a very small mismatch condition that arises in the array response vector.This mismatching in the array response vector practically arises when the characteristics of the true signal are different from that of the assumed ones.

Conclusion and future scope
As the number of subscribers are increasing, so are their demands for high data rates and secure communication.This thesis presented security issues in the 5G network.An extensive literature survey on the security scenario in D2D wireless communication network has been first received.We proposed to use adaptive resource allocation by using HMM with a diverse beamforming approach.We focus on using no orthogonal resource sharing mode, as it is effective for enhancing spectral efficiency of the cellular networks.Addition to this beamforming approach is also impinged for the higher values of the parameters of a WCN.Architecture for adaptive resource allocation for allocating the resource blocks to all the users optimally, followed by a beamforming approach with respect to the diversity phenomena is proposed.A stochastic approach is espoused for prime resource allocation to the CUs in the network.Adaptive allocation of resource blocks is performed within the network on the root of the applications demanded by CUs (video, voice or data).And after the resource allocation, the concept of diversity in the beamforming approach is impinged in order to secure the transmission of data.
The proposed architecture and algorithm for resource allocation is based on Hidden Markov Model (HMM) followed by diversity in the beamforming approach primarily targeting channel capacity maximization, enhanced secrecy rate and reduction in Secrecy Outage Probability (SOP).It is an operative elucidation for overpowering the numerous open issues in D2D communication network for CUs.With the proposed methodology, resources are mutual between the two types of users (cellular user equipment and D2D user equipment) efficiently without any resource wastage.
Initially, enhancement in channel capacity is witnessed with the use of sector antennas at the BS (theoretical architecture).Furthermore, higher values of the channel capacity are achieved by the application of the proposed adaptive resource allocation algorithm, which is eventually based on the Hidden Markov Model.Addition to it, for higher values of secrecy rate and lower value of secrecy outage probability, beamforming approach w.r.t.diversity is an optimal solution.This proposed scheme is capable of adaptively distributing the RBs without wastage according to the application that has been demanded and for the secure transmission of the RBs from BS to the particular CUs.A comparative study for the different parameters of the network like channel capacity, spectral and energy efficiency, secrecy rate and secrecy outage probability has been done between the theoretical scheme and the proposed scheme for depicting the improved results.The main focus of the architecture remains optimal resource allocation so as to meet the subscribers demands for channel capacity in the most efficient and preferable manner for higher secrecy rate using beamforming approach.A channel capacity value of up to 102 Mbps is achievable with the proposed algorithms and high values are desirable for the next generation.
Since by the use of directive antennas we are able to direct the beam to the user which is under attack for the secure communication between the BS and the cellular users.As a result, this architecture can be used as a primal solution for the scenario which is under attack having the RBs allocated with larger size.In the 5G networks, dense deployment scenarios are supported, which results in Ultra Dense Networks (UDNs).These mentioned networks are highly prone to attacks due to large numbers of subscribers like jamming which is a big threat for the secure transmission of data.The proposed network architecture is, in the way, prone to eavesdroppers, jammers etc. Research on the security aspect of the cellular links in such networks is a very open field for research work.Table 9 depicts the symbols used in paper.The distance between base station and cellular user, distance between base station and eves in beamforming scenario

Figure 1 .
Figure 1.System model for secure communication.

Figure 2 .
Figure 2. State diagram for secure transmission of data using HMM.

1 : 2 2
Input the parameters.Base Station: PB, PT, Pr, Pl Cellular user: Pa, r D2D users:    Channel: n,  0 , R, q, Ap, B • Step 2: Initialization.Generate the random user locations within a radius R for m iterations Initializing the number of cellular users, hence c = 0/* All the cellular users indices are in set c*/ Initializing the number of D2D pairs, hence D2D pair = 0/*All D2D pairs indices are in set d*/ • Step 3: Check the users forming D2D pairs and deployment of the cellular users.for a = 1:n for b = 1:n Compute the distance with following equation: d (a,b)= √ (_ () − _ () ) 2 + (_ () − _ () ) check for D2D pair formation: if d (a,b) ≤ d0 Pair = pair + 1/*formation of a pair; hence update the pair in set d*/ else c = c + 1/* formation of a cellular user; hence update the user in c*/ end • Step 4: Computation of different channel parameters.Different channel parameters like path loss, SNR, channel capacity, secrecy rate, spectral efficiency, secrecy outage probability and energy efficiency are computed and their respective values are plotted.Pseudocode 2: for resource allocation by using hmm (in Figure 5) • Step 1: Training of the data and calculation of prior probabilities.Computation of the set of probabilities and training of the data.•

• Step 4 :
Channel Capacity and secrecy rate computation.Compute both the parameters and compare with previous values.Plot the resultant values.• Step 5: Compute the secrecy outage probability.Obtain the values of SOP and compare it with earlier values.Plot the resultant values.

Figure 3 .
Figure 3. Flowchart for deployment of D2D pairs and cellular users.

Figure 4 .
Figure 4. Flowchart of computing different parameters of the channel.

Figure 8
Figure 8 clearly depicts the channel capacity analysis with the respective SNR.The comparison is made with the normal channel capacity, channel capacity when the eavesdropper attacks or intrudes the transmission of data from the Base Station to the cellular users that demanded the application and the channel capacity by using the beamforming approach with respect to the diversity with the maximum rate of 85 Mbps.By adapting the beamforming approach, we had an increased channel capacity as compared to the channel capacity of the normal channel and the values are depicted in Table3.

Figure 8 .
Figure 8.Comparison of channel capacity and SNR.

Figure 9 .
Figure 9.Comparison of channel capacity and SNR using HMM.

Figure 10 .
Figure 10.Comparison of spectral efficiency and SNR.

Figure 11 .
Figure 11.Comparison of spectral efficiency and SNR using HMM.

Figure 13 .
Figure 13.Comparison of energy efficiency and SNR using HMM.

Figure 15 .
Figure 15.Comparison of secrecy rate and SNR using HMM.

Figure 16 .
Figure 16.Comparison of secrecy outage probability and SNR.

Figure 17 .
Figure 17.Comparison of secrecy outage probability and SNR using HMM.

S
.no.Representation of symbols Meaning of symbols 1 Gd,cu(b) Channel gain taken between the cellular users. 2 Ib,d(a) The gain of interference link from the base station (BS) to ath D2D pair. 3 Id(a)cu(b) The interference link gain from a-th D2D pairs receiver to its b-th cellular users.4 Pd(a), Pcu(b) The transmitted power of the a-th D2D pair and b-th cellular users.

Table 3 .
Values of channel capacity.

Table 4 .
Values of channel capacity using HMM. S.

Table 5 .
Values of spectral efficiency S.

Table 6 .
Values of spectral efficiency using HMM. S.

Table 7 .
Values of energy efficiency.

Table 8 .
Values of energy efficiency using HMM.

Table 9 .
Representation of symbols.

5
,   The received signal strengths at BS of cellular user and eavesdropper 6  () ,   The transmission power from user and eves to BS. 7   ,   The impulse responses of the channel for user and eves.8  ℎ ,  ℎ The signal strength transmitted by user and eves.At the receiver the power received by the a-th D2D pair which is sharing k-th RB of b-th user.At the receiver the channel coefficient of the a-th D2D pair which is sharing k-th RB of b-th user.Threshold value of secrecy rate of a channel.31* ,   *  The received signal strengths at BS of CU and Eavesdropper in the beamforming scenario.* ,   * The impulse responses of the channel for user and eves.

no. Representation of symbols Meaning of symbols 34
* ,   *  The signal strength transmitted by user and eves in the beamforming scenarioThe interference power from the BS to cu42 ,() Received power from BS to eves in the beanforming scenario.