# Implementation and Evaluation of Nodal Distribution and Movement in a 5G Mobile Network
## 4 Implementation of Distribution and Movement  
Based on the above review on using the NS3 network simulator in various fields, it can be concluded that the simulator developers and the initiative groups of developers offer solutions for the modernization and implementation of novel standards, but the security issue remains open. Our own implementations to analyze 5G mobile networks in the field of interference immunity have been developed within this article. It was necessary to form a network model to study the compliance with the criteria for the integrity and availability of information within the framework of this work. The basis of the model was the algorithms for the distribution and movement of nodes. The amount of nodes and their position significantly influences the interfering frequency and channel quality in common. In this regard, the following tasks were set:  
* Developing algorithm of the distribution of n network nodes in a defined area;
* Developing an algorithm of subscriber node movement based on their equidistant from a base station. The optimal planning of device distribution within a network, nodes movement simulation and analysis of noise immunity throughout the entire process of device interaction is of particular importance when organizing mobile networks. The main task of the models is to determine and predict the parameters of the functioning of a mobile network, such as traffic intensity, delays and packet loss in the channel. For this reason, a subscriber distributing algorithm was implemented, demonstrating the behavior of the signal-to-noise ratio at the initial stage of modeling. The first step in the distributing algorithm is the definition of a rectangular area. There is a need to set positions of base stations firstly to do this. They will define the area based on their index in the software environment. Further, the area of the distribution of the associated subscribers is set for each base station. This area is bounded by two radii that form a ring. The block scheme of the distribution is shown in Figure 1. As input parameters set following:  
* Position of the subscriber's base station;
* Height of the subscriber's antenna;
* Small and large radiuses of the area. This function determines the distance between the subscriber and the base station and the angle. The base coordinate system in the NS-3 modeling environment is a Cartesian-coordinate system. Therefore, it is necessary to convert the obtained coordinates from cylindrical to Cartesian. As a result, the function returns the position as an object of the Vector class. The full implementation of the function is shown in Algorithm 1. ```
1 Vector
2 getUeRandomVectorPosition
3(
4 double gNB_X, double gNB_Y, double e_height,
5 double R, double r_m
6)
7{
8 double r = (R-r_m) * sqrt((double)(rand()/RAND_MAX) + r_m;
9 double theta = (double)(rand())/RAND_MAX * 2 * M_PI;

Figure 1: Block scheme of the distribution. * double x = gIB_X + r
* double y = gIB_Y + r
* Vector res = Vector (x, y, ue_height);
* return res;
* }

The interference pattern should be changed when the subscribers move. The effect of reducing the SINR indicator should appear when an object moves away from the base station and when it is near other objects in the system. It indicates a deterioration in communication performance. On this basis, the packet loss increases and, consequently, the BLER parameter increases. A solution, where subscribers moved in a straight line away from the base station, was implemented to observe this event. The function describing the trajectory of subscribers' movement is shown in Figure 2. The linear function (Function 1), set by the positions of the subscriber and the base station, is used to determine the trajectory. \[f(x)=\frac{Y_{1}-Y_{0}}{X_{1}-X_{0}}(X-X_{0}), \tag{1}\]

The block scheme of the movement is shown in Figure 3. And the full implementation of this method is shown in Algorithm 2. ```
1 Vector gnb,ue;
2 double distance = 1000.0;
3 double frcount = 0.01;  
Figure 3: Block scheme of the movement.