Datasets:
ArXiv:
License:
Upload files for generating data
Browse files- genChannelDrop.m +77 -0
- generate.m +120 -0
genChannelDrop.m
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function [H, PG] = genChannelDrop(par, v, samples_per_sec)
|
2 |
+
|
3 |
+
% Distance
|
4 |
+
dist_tot = v * par.sequenceLength / samples_per_sec;
|
5 |
+
samples_per_meter = 1 / (dist_tot / par.sequenceLength);
|
6 |
+
|
7 |
+
% par.l.simpar.samples_per_meter = samples_per_meter; not necessary
|
8 |
+
|
9 |
+
% Create tracks
|
10 |
+
for i = 1:par.l.no_rx
|
11 |
+
name = par.l.track(1, i).name;
|
12 |
+
par.l.track(1, i) = qd_track('linear', 1/samples_per_meter*(par.sequenceLength - 1));
|
13 |
+
par.l.track(1, i).name = name;
|
14 |
+
par.l.track(1, i).scenario = 'BERLIN_UMa_NLOS';
|
15 |
+
end
|
16 |
+
|
17 |
+
% Add random positions
|
18 |
+
distances = sqrt(rand(1, par.l.no_rx)*(par.maxDistance^2 - par.minDistance^2)+par.minDistance^2);
|
19 |
+
angles = (2 * rand(1, par.l.no_rx) - 1) * par.sectorAngleRad;
|
20 |
+
par.l.rx_position = [cos(angles) .* distances; sin(angles) .* distances; 1.5 .* ones(1, par.l.no_rx)];
|
21 |
+
|
22 |
+
for i = 1:par.l.no_rx
|
23 |
+
par.l.track(1, i).movement_profile = ...
|
24 |
+
[0, 1 / samples_per_meter * (par.sequenceLength - 1) / v; ...
|
25 |
+
0, 1 / samples_per_meter * (par.sequenceLength - 1)];
|
26 |
+
|
27 |
+
par.l.track(1, i).interpolate('time', 1/samples_per_sec);
|
28 |
+
end
|
29 |
+
|
30 |
+
% for i=1:par.l.no_rx
|
31 |
+
% a = par.l.track(1,i).initial_position+par.l.track(1,i).positions;
|
32 |
+
% if sum(abs(atan(a(2,:)./a(1,:))) > par.sectorAngleRad)
|
33 |
+
% disp('Out of sector angle')
|
34 |
+
% i
|
35 |
+
% end
|
36 |
+
% if sum(sqrt(a(1,:).^2+a(2,:).^2) > par.maxDistance)
|
37 |
+
% disp('Out of range r')
|
38 |
+
% i
|
39 |
+
% end
|
40 |
+
% end
|
41 |
+
|
42 |
+
% Get channel impulse reponses
|
43 |
+
H_raw = par.l.get_channels();
|
44 |
+
|
45 |
+
% Get channels in frequency domain: only consider single carrier
|
46 |
+
H = zeros(1, par.l.no_rx, par.l.tx_array.no_elements, par.sequenceLength);
|
47 |
+
|
48 |
+
PG = zeros(1, par.l.no_rx);
|
49 |
+
|
50 |
+
for k = 1:par.l.no_rx
|
51 |
+
h = squeeze(H_raw(k).fr(par.bandwidth, 1, 1:par.sequenceLength));
|
52 |
+
|
53 |
+
pg = sqrt(10.^(0.1 * H_raw(k).par.pg_parset));
|
54 |
+
h = h / pg;
|
55 |
+
|
56 |
+
% Visualize channels
|
57 |
+
% figure
|
58 |
+
% surf(real(h), 'EdgeColor', 'None');
|
59 |
+
% view(2)
|
60 |
+
% title('Real part CSI sample sequence')
|
61 |
+
% xlabel('shapshots')
|
62 |
+
% ylabel('BS antennas')
|
63 |
+
|
64 |
+
% figure
|
65 |
+
% surf(imag(h));
|
66 |
+
% view(2)
|
67 |
+
% title('Imag part CSI sample sequence')
|
68 |
+
% xlabel('n shapshots')
|
69 |
+
% ylabel('BS antennas')
|
70 |
+
|
71 |
+
|
72 |
+
H(1, k, :, :) = single(h);
|
73 |
+
PG(1, k) = single(pg);
|
74 |
+
end
|
75 |
+
H = {H};
|
76 |
+
PG = {PG};
|
77 |
+
end
|
generate.m
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
close all
|
2 |
+
clear
|
3 |
+
|
4 |
+
rng(27)
|
5 |
+
%%
|
6 |
+
|
7 |
+
% numDrops \times K = 32K
|
8 |
+
|
9 |
+
numDrops = 1500; % Number of random user drops to simulate
|
10 |
+
sequenceLength = 20; % Number of snapshots for each track
|
11 |
+
|
12 |
+
K = 100; % Number of users
|
13 |
+
|
14 |
+
centerFrequency = 2.6e9;
|
15 |
+
bandwidth = 20e6;
|
16 |
+
|
17 |
+
antennaHeight = 25; % Antenna height of the BS station in m
|
18 |
+
antennaSpacing = 1 / 2; % Antenna spacing in multiples of the wavelength
|
19 |
+
M_V = 8; % Number of vertical antenna elements
|
20 |
+
M_H = 4; % Number of horizontal antenna elements
|
21 |
+
|
22 |
+
minDistance = 50;
|
23 |
+
maxDistance = 150;
|
24 |
+
userHeight = 1.5;
|
25 |
+
sectorAngle = 60;
|
26 |
+
sectorAngleRad = sectorAngle / 180 * pi;
|
27 |
+
|
28 |
+
|
29 |
+
%% Scenario
|
30 |
+
s = qd_simulation_parameters;
|
31 |
+
s.center_frequency = centerFrequency;
|
32 |
+
s.use_absolute_delays = 1; % Include delay of the LOS path
|
33 |
+
s.show_progress_bars = 0;
|
34 |
+
lambda = s.speed_of_light / centerFrequency;
|
35 |
+
%% Layout
|
36 |
+
l = qd_layout(s);
|
37 |
+
|
38 |
+
% Base station
|
39 |
+
l.no_tx = 1;
|
40 |
+
l.tx_position(3) = antennaHeight;
|
41 |
+
% l.tx_array = qd_arrayant('3gpp-3d', M_V, M_H, centerFrequency, 3, 0, antennaSpacing);
|
42 |
+
l.tx_array = qd_arrayant('3gpp-3d', M_V, M_H, centerFrequency);
|
43 |
+
|
44 |
+
% for n = 1:M_V
|
45 |
+
% for nn = 1:M_H
|
46 |
+
% indeces = (n - 1) * M_H + nn;
|
47 |
+
% l.tx_array.element_position(1, indeces) = ...
|
48 |
+
% (nn) * antennaSpacing * lambda - lambda / 4 - M_V / 2 * antennaSpacing * lambda;
|
49 |
+
%
|
50 |
+
%
|
51 |
+
% l.tx_array.element_position(2, indeces) = 0;
|
52 |
+
% l.tx_array.element_position(3, indeces) = ...
|
53 |
+
% (n) * antennaSpacing * lambda - lambda / 4 - M_H / 2 * antennaSpacing * lambda + antennaHeight;
|
54 |
+
%
|
55 |
+
%
|
56 |
+
% end
|
57 |
+
% end
|
58 |
+
|
59 |
+
% Users
|
60 |
+
l.no_rx = K;
|
61 |
+
l.rx_array = qd_arrayant('omni');
|
62 |
+
|
63 |
+
l.set_scenario('BERLIN_UMa_NLOS');
|
64 |
+
|
65 |
+
|
66 |
+
%% Create struct to store parameters
|
67 |
+
par.minDistance = minDistance;
|
68 |
+
par.maxDistance = maxDistance;
|
69 |
+
par.sectorAngleRad = sectorAngleRad;
|
70 |
+
par.bandwidth = bandwidth;
|
71 |
+
par.sequenceLength = sequenceLength;
|
72 |
+
par.s = s;
|
73 |
+
|
74 |
+
params = cell(1, numDrops);
|
75 |
+
for n = 1:numDrops
|
76 |
+
params{1, n} = par;
|
77 |
+
params{1, n}.l = l.copy;
|
78 |
+
end
|
79 |
+
|
80 |
+
|
81 |
+
h = cell(1, numDrops);
|
82 |
+
pg = cell(1, numDrops);
|
83 |
+
velocity_ms = cell(1, numDrops);
|
84 |
+
|
85 |
+
%% Generate tracks
|
86 |
+
|
87 |
+
Ts = 0.5e-3; % slot time
|
88 |
+
fs = 1/Ts;
|
89 |
+
|
90 |
+
Tsym = 33.33e-6; % considering that a slot contains 14 symbols
|
91 |
+
|
92 |
+
for n = 1:numDrops
|
93 |
+
|
94 |
+
n
|
95 |
+
|
96 |
+
v = raylrnd(8);
|
97 |
+
% doppler = v/lambda % Hz
|
98 |
+
% norm_doppler = v/lambda * Tsym;
|
99 |
+
velocity_ms(1, n) = {v};
|
100 |
+
|
101 |
+
[h(1, n), pg(1, n)] = genChannelDrop(params{1, n}, v, fs);
|
102 |
+
end
|
103 |
+
|
104 |
+
%% Save HDF5
|
105 |
+
H = cell2mat(h');
|
106 |
+
H_r = real(H);
|
107 |
+
H_i = imag(H);
|
108 |
+
|
109 |
+
clear h
|
110 |
+
hdf5write('./channels.hdf5', 'H_r', H_r, 'H_i', H_i)
|
111 |
+
|
112 |
+
PG = cell2mat(pg');
|
113 |
+
clear pg
|
114 |
+
hdf5write('./pgs.hdf5', 'PG', PG)
|
115 |
+
|
116 |
+
VELOCITY_MS = cell2mat(velocity_ms);
|
117 |
+
clear velocity_ms
|
118 |
+
hdf5write('./velocity_ms.hdf5', 'VELOCITY_MS', VELOCITY_MS)
|
119 |
+
|
120 |
+
|