-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathue.cpp
115 lines (86 loc) · 2.54 KB
/
ue.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "common.h"
#include "const.h"
#include <iostream>
#include <fstream>
using namespace std;
#include <cstring>
#include <cstdlib>
/*===================================================================
FUNCTION: UE::UE()
AUTHOR: Seong-Jun Oh
DESCRIPTION: UE Object Constructor
NOTES: Currently, nothing is done when a UE is instantiated
===================================================================*/
UE::UE()
{
}
/*===================================================================
FUNCTION: UE::~UE()
AUTHOR: Seong-Jun Oh
DESCRIPTION: UE Object Destructor
NOTES: Currently, nothing is done
===================================================================*/
UE::~UE()
{
}
/*===================================================================
FUNCTION: UE::Configure( int self_idx )
AUTHOR: Seong-Jun Oh, Kyung-Won Kim
DESCRIPTION: UE object gets to know the index of itself
NOTES:
===================================================================*/
void UE::Configure( int self_idx )
{
void StaticGainGeneration( int , double * , LOCATION * );
void FadingChannelGeneration( int, int, int, int ) ;
_self_idx = self_idx ;
if ( drop_idx == 0 )
{
static_gain = new double[ NUM_SECTORS ] ;
LS_gain = new double[ NUM_SECTORS ] ;
PathLoss = new double[ NUM_SECTORS ] ;
Distance = new double[ NUM_SECTORS ] ;
adj_sector = new int[num_compute_coef] ;
}
StaticGainGeneration( self_idx , static_gain , &coordinate );
for(int sec_idx = 0; sec_idx < NUM_SECTORS; sec_idx++)
{
PathLoss[ sec_idx ] = path_loss[ sec_idx ] ;
Distance[ sec_idx ] = ue2sector_distance[self_idx][ sec_idx ] ;
LS_gain[ sec_idx ] = static_gain[ sec_idx ] + antenna[ sec_idx ] ;
}
for(int i = 1; i < NUM_SECTORS; i++)
{
double temp;
int j ;
temp = LS_gain[i];
for(j = i; j > 0; j--)
{
if( LS_gain[j-1] < temp )
LS_gain[j] = LS_gain[j-1];
else break;
}
LS_gain[j] = temp;
}
for(int sec_idx = 0; sec_idx < NUM_SECTORS; sec_idx++)
{
for(int idx = 0; idx < num_compute_coef; idx++)
{
if( (int)(1000000*LS_gain[ idx ]) == (int)(1000000*(static_gain[ sec_idx ] + antenna[ sec_idx ])) )
{
adj_sector[idx] = sec_idx ;
}
}
}
sector_in_control = adj_sector[0] ;
for(int adj_sec_idx = 0; adj_sec_idx < num_compute_coef; adj_sec_idx++)
{
for(int u = 0; u < num_received_antenna; u++)
{
for(int s = 0; s < num_transmit_antenna; s++)
{
FadingChannelGeneration( self_idx, u, s, adj_sec_idx ) ;
}
}
}
}