reverse-ordering / generate.m
valerizz's picture
Upload files for generating data
7c5589a verified
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)