-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLTE_init_create_hexagonal_eNodeB_grid.m
More file actions
42 lines (35 loc) · 1.62 KB
/
LTE_init_create_hexagonal_eNodeB_grid.m
File metadata and controls
42 lines (35 loc) · 1.62 KB
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
function [ eNodeB_sites ] = LTE_init_create_hexagonal_eNodeB_grid(LTE_config)
% Creates an hexagonal set of eNodeBs according to the loaded parameters
% BTS generation is taken from the xf_generate_hsdpa_network from Martin Wrulich's MIMO-HSDPA simulator
% (c) Josep Colom Ikuno, Martin Wrulich INTHFT, 2008
% Distance between BTSs
inter_bts_distance = LTE_config.inter_eNodeB_distance;
% Number of BTS rings in the network map
n_rings = LTE_config.nr_eNodeB_rings;
%total nr. of eNodeBs
% each ring consists of 6 NodeBs at the corners of the hexagon
% each edge then has "i-1" further NodeBs, where "i" is the ring index
% total_nr_eNodeB = sum(6*(1:n_rings))+1;
[tmp_gridx,tmp_gridy] = meshgrid(-n_rings:n_rings,...
(-n_rings:n_rings)*sin(pi/3)); %regular grid
if mod(n_rings,2) == 0
tmp_shift_idx = 2:2:2*n_rings+1; %shift all even rows
else
tmp_shift_idx = 1:2:2*n_rings+1; %shift all odd rows
end
tmp_gridx(tmp_shift_idx,:) = tmp_gridx(tmp_shift_idx,:) + 0.5; %shift
rot = @(w_) [cos(w_),-sin(w_);sin(w_),cos(w_)]; %rotation operator
for i_ = 1:7
%border of the network
tmp_hex(i_,:) = ((n_rings+0.5)*rot(pi/3)^(i_-1)*[1;0]).'; %#ok<AGROW>
end
tmp_valid_positions = inpolygon(tmp_gridx,tmp_gridy,tmp_hex(:,1),tmp_hex(:,2));
tmp_x = tmp_gridx(tmp_valid_positions);
tmp_y = tmp_gridy(tmp_valid_positions);
%% Create the eNodeB array
for b_ = 1:length(tmp_x)
eNodeB_sites(b_) = network_elements.eNodeB;
eNodeB_sites(b_).id = b_;
eNodeB_sites(b_).pos = [tmp_x(b_)*inter_bts_distance tmp_y(b_)*inter_bts_distance];
eNodeB_sites(b_).site_type = 'macro';
end