File size: 2,695 Bytes
7c5589a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
115
116
117
118
119
120
121
close all
clear

rng(27)
%%

% numDrops \times K = 32K

numDrops = 1500; % Number of random user drops to simulate
sequenceLength = 20; % Number of snapshots for each track

K = 100; % Number of users

centerFrequency = 2.6e9;
bandwidth = 20e6;

antennaHeight = 25; % Antenna height of the BS station in m
antennaSpacing = 1 / 2; % Antenna spacing in multiples of the wavelength
M_V = 8; % Number of vertical antenna elements
M_H = 4; % Number of horizontal antenna elements

minDistance = 50;
maxDistance = 150;
userHeight = 1.5;
sectorAngle = 60;
sectorAngleRad = sectorAngle / 180 * pi;


%% Scenario
s = qd_simulation_parameters;
s.center_frequency = centerFrequency;
s.use_absolute_delays = 1; % Include delay of the LOS path
s.show_progress_bars = 0;
lambda = s.speed_of_light / centerFrequency;
%% Layout
l = qd_layout(s);

% Base station
l.no_tx = 1;
l.tx_position(3) = antennaHeight;
% l.tx_array = qd_arrayant('3gpp-3d', M_V, M_H, centerFrequency, 3, 0, antennaSpacing);
l.tx_array = qd_arrayant('3gpp-3d', M_V, M_H, centerFrequency);

% for n = 1:M_V
%     for nn = 1:M_H
%         indeces = (n - 1) * M_H + nn;
%         l.tx_array.element_position(1, indeces) = ...
%             (nn) * antennaSpacing * lambda - lambda / 4 - M_V / 2 * antennaSpacing * lambda;
%         
%         
%         l.tx_array.element_position(2, indeces) = 0;
%         l.tx_array.element_position(3, indeces) = ...
%             (n) * antennaSpacing * lambda - lambda / 4 - M_H / 2 * antennaSpacing * lambda + antennaHeight;
%         
%         
%     end
% end

% Users
l.no_rx = K;
l.rx_array = qd_arrayant('omni');

l.set_scenario('BERLIN_UMa_NLOS');


%% Create struct to store parameters
par.minDistance = minDistance;
par.maxDistance = maxDistance;
par.sectorAngleRad = sectorAngleRad;
par.bandwidth = bandwidth;
par.sequenceLength = sequenceLength;
par.s = s;

params = cell(1, numDrops);
for n = 1:numDrops
    params{1, n} = par;
    params{1, n}.l = l.copy;
end


h = cell(1, numDrops);
pg = cell(1, numDrops);
velocity_ms = cell(1, numDrops);

%% Generate tracks

Ts = 0.5e-3; % slot time
fs = 1/Ts;

Tsym = 33.33e-6; % considering that a slot contains 14 symbols

for n = 1:numDrops
    
    n

    v = raylrnd(8);
%     doppler = v/lambda % Hz
%     norm_doppler = v/lambda * Tsym;
    velocity_ms(1, n) = {v};
    
    [h(1, n), pg(1, n)] = genChannelDrop(params{1, n}, v, fs);
end

%% Save HDF5
H = cell2mat(h');
H_r = real(H);
H_i = imag(H);

clear h
hdf5write('./channels.hdf5', 'H_r', H_r, 'H_i', H_i)

PG = cell2mat(pg');
clear pg
hdf5write('./pgs.hdf5', 'PG', PG)

VELOCITY_MS = cell2mat(velocity_ms);
clear velocity_ms
hdf5write('./velocity_ms.hdf5', 'VELOCITY_MS', VELOCITY_MS)