Skip to content

Commit

Permalink
Merge pull request #11 from DeepMIMO/new-data-format
Browse files Browse the repository at this point in the history
DeepMIMOv3 merge
  • Loading branch information
umut-demirhan authored May 21, 2024
2 parents 4111aff + ba81da0 commit 52a7a35
Show file tree
Hide file tree
Showing 26 changed files with 1,168 additions and 460 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Raytracing_scenarios/*
Examples/dmv3_example_html/*
6 changes: 5 additions & 1 deletion DeepMIMO_Dataset_Generator.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
% ----------------- Add the path of DeepMIMO function --------------------%
addpath('DeepMIMO_functions')
addpath(genpath('DeepMIMO_functions'))

% -------------------- DeepMIMO Dataset Generation -----------------------%
% Load Dataset Parameters
dataset_params = read_params('parameters.m');
[DeepMIMO_dataset, dataset_params] = DeepMIMO_generator(dataset_params);

% To plot the LoS status of each user, provide the basestation data
% into plot_los_status function.
plot_los_status(DeepMIMO_dataset{1}); % Plots the LoS for the first basestation

% -------------------------- Output Examples -----------------------------%
% DeepMIMO_dataset{i}.user{j}.channel % Channel between BS i - User j
% % (# of User antennas) x (# of BS antennas) x (# of OFDM subcarriers)
Expand Down
127 changes: 89 additions & 38 deletions DeepMIMO_functions/DeepMIMO_generator.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,19 @@
if params_inner.dynamic_scenario
for f = 1:length(params_inner.list_of_folders)
fprintf('\nGenerating Scene %i/%i', f, length(params_inner.list_of_folders))
params.scenario_files = fullfile(params_inner.list_of_folders{f}, params.scenario); % The initial of all the scenario files
params.scenario_files = params_inner.list_of_folders{f}; % The initial of all the scenario files
DeepMIMO_scene{f} = generate_data(params, params_inner);
param{f} = params;
end

DeepMIMO_dataset = DeepMIMO_scene;
params = param;
saveDataset = params{1}.saveDataset;
else
DeepMIMO_dataset = generate_data(params, params_inner);
saveDataset = params.saveDataset;
end

% Saving the data
if saveDataset
fprintf('\n Saving the DeepMIMO Dataset ...')


fileidx = 1;
while isfile(sprintf('DeepMIMO_dataset/dataset_%i.mat', fileidx))
fileidx = fileidx + 1;
if params_inner.dual_polar_available
DeepMIMO_dataset = generate_data_polar(params, params_inner);
else
DeepMIMO_dataset = generate_data(params, params_inner);
end
sfile_DeepMIMO = sprintf('DeepMIMO_dataset/dataset_%i.mat', fileidx);
dataset_params = params;
save(sfile_DeepMIMO,'DeepMIMO_dataset', 'dataset_params', '-v7.3');

fprintf('\n The generated DeepMIMO dataset is saved into %s file.', sfile_DeepMIMO);

end

fprintf('\n DeepMIMO Dataset Generation completed \n')
Expand All @@ -55,62 +40,128 @@
for t=1:params.num_active_BS
bs_ID = params.active_BS(t);
fprintf('\n Basestation %i', bs_ID);
[TX{t}.channel_params, TX{t}.channel_params_BSBS, TX{t}.loc] = read_raytracing(bs_ID, params, params_inner.scenario_files);
[TX{t}.channel_params, TX{t}.channel_params_BSBS, TX{t}.loc] = feval(params_inner.raytracing_fn, bs_ID, params, params_inner);
end

% Constructing the channel matrices from ray-tracing
for t = 1:params.num_active_BS
fprintf('\n Constructing the DeepMIMO Dataset for BS %d', params.active_BS(t))
c = progress_counter(params.num_user+params.enable_BS2BSchannels*params.num_active_BS);
c = progress_counter(length(TX{t}.channel_params)+params.num_active_BS);

% BS transmitter location & rotation
DeepMIMO_dataset{t}.loc = TX{t}.loc;
DeepMIMO_dataset{t}.rotation = params_inner.array_rotation_BS(t,:);

%----- BS-User Channels
for user=1:params.num_user
for user=1:length(TX{t}.channel_params)
% Channel Construction

if params.generate_OFDM_channels
[DeepMIMO_dataset{t}.user{user}.channel]=construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params.ant_spacing_UE, TX{t}.channel_params(user), params);
[DeepMIMO_dataset{t}.user{user}.channel, LOS, TX{t}.channel_params(user)] = construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params_inner.ant_FoV_UE, params.ant_spacing_UE, TX{t}.channel_params(user), params, params_inner);
else
[DeepMIMO_dataset{t}.user{user}.channel]=construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params.ant_spacing_UE, TX{t}.channel_params(user), params);
[DeepMIMO_dataset{t}.user{user}.channel, LOS, TX{t}.channel_params(user)] = construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params_inner.ant_FoV_UE, params.ant_spacing_UE, TX{t}.channel_params(user), params, params_inner);
DeepMIMO_dataset{t}.user{user}.ToA = TX{t}.channel_params(user).ToA; %Time of Arrival/Flight of each channel path (seconds)
end
DeepMIMO_dataset{t}.user{user}.rotation = params_inner.array_rotation_UE(user, :);

% Location, LOS status, distance, pathloss, and channel path parameters
DeepMIMO_dataset{t}.user{user}.loc=TX{t}.channel_params(user).loc;
DeepMIMO_dataset{t}.user{user}.LoS_status=TX{t}.channel_params(user).LoS_status;
DeepMIMO_dataset{t}.user{user}.LoS_status = LOS;
DeepMIMO_dataset{t}.user{user}.distance=TX{t}.channel_params(user).distance;
%% TO BE UPDATED
DeepMIMO_dataset{t}.user{user}.pathloss=TX{t}.channel_params(user).pathloss;

%%
DeepMIMO_dataset{t}.user{user}.path_params=rmfield(TX{t}.channel_params(user),{'loc','distance','pathloss'});

c.increment();
end

%----- BS-BS Channels
if params.enable_BS2BSchannels
for BSreceiver=1:params.num_active_BS
for BSreceiver=1:params.num_active_BS
% Channel Construction
if params.generate_OFDM_channels
[DeepMIMO_dataset{t}.basestation{BSreceiver}.channel, LOS, TX{t}.channel_params_BSBS(BSreceiver)] = construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_FoV_BS(BSreceiver, :), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params, params_inner);
else
[DeepMIMO_dataset{t}.basestation{BSreceiver}.channel, LOS, TX{t}.channel_params_BSBS(BSreceiver)]=construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_FoV_BS(BSreceiver, :), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params, params_inner);
DeepMIMO_dataset{t}.basestation{BSreceiver}.ToA=TX{t}.channel_params_BSBS(BSreceiver).ToA; %Time of Arrival/Flight of each channel path (seconds)
end
DeepMIMO_dataset{t}.basestation{BSreceiver}.rotation = params_inner.array_rotation_BS(BSreceiver, :);

% Location, LOS status, distance, pathloss, and channel path parameters
DeepMIMO_dataset{t}.basestation{BSreceiver}.loc=TX{t}.channel_params_BSBS(BSreceiver).loc;
DeepMIMO_dataset{t}.basestation{BSreceiver}.LoS_status=LOS;
DeepMIMO_dataset{t}.basestation{BSreceiver}.distance=TX{t}.channel_params_BSBS(BSreceiver).distance;

%% Update Path loss
DeepMIMO_dataset{t}.basestation{BSreceiver}.pathloss=TX{t}.channel_params_BSBS(BSreceiver).pathloss;
DeepMIMO_dataset{t}.basestation{BSreceiver}.path_params=rmfield(TX{t}.channel_params_BSBS(BSreceiver),{'loc','distance','pathloss'});

c.increment();
end
end
end

function DeepMIMO_dataset = generate_data_polar(params, params_inner)
% Reading ray tracing data
fprintf('\n Reading the channel parameters of the ray-tracing scenario %s', params.scenario)
for t=1:params.num_active_BS
bs_ID = params.active_BS(t);
for polarization = params_inner.polarization_list
fprintf('\n Basestation %i', bs_ID);
[TX{t}.channel_params, TX{t}.channel_params_BSBS, TX{t}.loc] = feval(params_inner.raytracing_fn, bs_ID, params, params_inner, polarization);

fprintf('\n Constructing the DeepMIMO Dataset for BS %d', params.active_BS(t))
c = progress_counter(params.num_user+params.num_active_BS);

% BS transmitter location & rotation
DeepMIMO_dataset{t}.loc = TX{t}.loc;
DeepMIMO_dataset{t}.rotation = params_inner.array_rotation_BS(t,:);

%----- BS-User Channels
for user=1:length(TX{t}.channel_params)
% Channel Construction
if params.generate_OFDM_channels
[DeepMIMO_dataset{t}.basestation{BSreceiver}.channel]=construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params);
[DeepMIMO_dataset{t}.user{user}.(strcat("channel", polarization)), LOS, TX{t}.channel_params(user)] = construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params_inner.ant_FoV_UE, params.ant_spacing_UE, TX{t}.channel_params(user), params, params_inner);
else
[DeepMIMO_dataset{t}.basestation{BSreceiver}.channel]=construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params);
DeepMIMO_dataset{t}.basestation{BSreceiver}.ToA=TX{t}.channel_params_BSBS(BSreceiver).ToA; %Time of Arrival/Flight of each channel path (seconds)
[DeepMIMO_dataset{t}.user{user}.(strcat("channel", polarization)), LOS, TX{t}.channel_params(user)] = construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params.num_ant_UE, params_inner.array_rotation_UE(user, :), params_inner.ant_FoV_UE, params.ant_spacing_UE, TX{t}.channel_params(user), params, params_inner);
DeepMIMO_dataset{t}.user{user}.ToA = TX{t}.channel_params(user).ToA; %Time of Arrival/Flight of each channel path (seconds)
end
DeepMIMO_dataset{t}.basestation{BSreceiver}.rotation = params_inner.array_rotation_BS(BSreceiver, :);
DeepMIMO_dataset{t}.user{user}.rotation = params_inner.array_rotation_UE(user, :);

% Location, LOS status, distance, pathloss, and channel path parameters
DeepMIMO_dataset{t}.basestation{BSreceiver}.loc=TX{t}.channel_params_BSBS(BSreceiver).loc;
DeepMIMO_dataset{t}.basestation{BSreceiver}.LoS_status=TX{t}.channel_params_BSBS(BSreceiver).LoS_status;
DeepMIMO_dataset{t}.basestation{BSreceiver}.distance=TX{t}.channel_params_BSBS(BSreceiver).distance;
DeepMIMO_dataset{t}.basestation{BSreceiver}.pathloss=TX{t}.channel_params_BSBS(BSreceiver).pathloss;
DeepMIMO_dataset{t}.basestation{BSreceiver}.path_params=rmfield(TX{t}.channel_params_BSBS(BSreceiver),{'loc','distance','pathloss'});
DeepMIMO_dataset{t}.user{user}.loc=TX{t}.channel_params(user).loc;
DeepMIMO_dataset{t}.user{user}.LoS_status = LOS;
DeepMIMO_dataset{t}.user{user}.distance=TX{t}.channel_params(user).distance;
%% TO BE UPDATED
DeepMIMO_dataset{t}.user{user}.pathloss=TX{t}.channel_params(user).pathloss;
DeepMIMO_dataset{t}.user{user}.path_params=rmfield(TX{t}.channel_params(user),{'loc','distance','pathloss'});

c.increment();
end

if ~isempty(TX{t}.channel_params_BSBS)
%----- BS-BS Channels
for BSreceiver=1:params.num_active_BS
% Channel Construction
if params.generate_OFDM_channels
[DeepMIMO_dataset{t}.basestation{BSreceiver}.(strcat("channel", polarization)), LOS, TX{t}.channel_params_BSBS(BSreceiver)] = construct_DeepMIMO_channel(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_FoV_BS(BSreceiver, :), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params, params_inner);
else
[DeepMIMO_dataset{t}.basestation{BSreceiver}.(strcat("channel", polarization)), LOS, TX{t}.channel_params_BSBS(BSreceiver)]=construct_DeepMIMO_channel_TD(params_inner.num_ant_BS(t, :), params_inner.array_rotation_BS(t,:), params_inner.ant_FoV_BS(t, :), params_inner.ant_spacing_BS(t), params_inner.num_ant_BS(BSreceiver, :), params_inner.array_rotation_BS(BSreceiver,:), params_inner.ant_FoV_BS(BSreceiver, :), params_inner.ant_spacing_BS(BSreceiver), TX{t}.channel_params_BSBS(BSreceiver), params, params_inner);
DeepMIMO_dataset{t}.basestation{BSreceiver}.ToA=TX{t}.channel_params_BSBS(BSreceiver).ToA; %Time of Arrival/Flight of each channel path (seconds)
end
DeepMIMO_dataset{t}.basestation{BSreceiver}.rotation = params_inner.array_rotation_BS(BSreceiver, :);

% Location, LOS status, distance, pathloss, and channel path parameters
DeepMIMO_dataset{t}.basestation{BSreceiver}.loc=TX{t}.channel_params_BSBS(BSreceiver).loc;
DeepMIMO_dataset{t}.basestation{BSreceiver}.LoS_status=LOS;
DeepMIMO_dataset{t}.basestation{BSreceiver}.distance=TX{t}.channel_params_BSBS(BSreceiver).distance;
DeepMIMO_dataset{t}.basestation{BSreceiver}.pathloss=TX{t}.channel_params_BSBS(BSreceiver).pathloss;
DeepMIMO_dataset{t}.basestation{BSreceiver}.path_params=rmfield(TX{t}.channel_params_BSBS(BSreceiver),{'loc','distance','pathloss'});

c.increment();
end
end
end
end

end
14 changes: 14 additions & 0 deletions DeepMIMO_functions/antenna/antenna_FoV.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
% --------- DeepMIMO: A Generic Dataset for mmWave and massive MIMO ------%
% Authors: Ahmed Alkhateeb, Umut Demirhan, Abdelrahman Taha
% Date: March 17, 2022
% Goal: Encouraging research on ML/DL for MIMO applications and
% providing a benchmarking tool for the developed algorithms
% ---------------------------------------------------------------------- %

function path_inclusion = antenna_FoV(theta, phi, FoV_limits)
path_inclusion = ((phi <= 0+FoV_limits(1)/2) ...
| (phi >= 360-FoV_limits(1)/2)) ...
& ((theta <= 90+FoV_limits(2)/2) ...
& (theta >= 90-FoV_limits(2)/2));
end

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
% providing a benchmarking tool for the developed algorithms
% ---------------------------------------------------------------------- %

function Directivity = antenna_pattern_halfwavedipole(Theta,Phi)
function Directivity = antenna_pattern_halfwavedipole(Theta, Phi)
%RADIATION PATTERN EFFECT on the receive power calculation
% Calculate Half-wave dipole directivity in a given direction
% It is an omni directional radiation pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
% providing a benchmarking tool for the developed algorithms
% ---------------------------------------------------------------------- %

function [DoD_theta_LCS, DoD_phi_LCS, DoA_theta_LCS, DoA_phi_LCS] = axes_rotation(TX_rot, DoD_theta_GCS, DoD_phi_GCS, RX_rot, DoA_theta_GCS, DoA_phi_GCS)
%AXES ROTATION EFFECT on the DoDs and the DOAs
function [DoD_theta_LCS, DoD_phi_LCS, DoA_theta_LCS, DoA_phi_LCS] = antenna_rotation(TX_rot, DoD_theta_GCS, DoD_phi_GCS, RX_rot, DoA_theta_GCS, DoA_phi_GCS)
%AXES ROTATION EFFECT on the DoDs and the DOA

% Arbitrary 3D axes rotation from the "global coordinate system" (x,y,z) of the
% chose scenario to the "the local coordinate systems" (x',y',z') relative
% to the new panel orientation

[DoD_theta_LCS,DoD_phi_LCS]= angle_transformation(TX_rot,DoD_theta_GCS,DoD_phi_GCS);
[DoA_theta_LCS,DoA_phi_LCS]= angle_transformation(RX_rot,DoA_theta_GCS,DoA_phi_GCS);
[DoD_theta_LCS,DoD_phi_LCS]= rotateAngles(TX_rot, DoD_theta_GCS, DoD_phi_GCS);
[DoA_theta_LCS,DoA_phi_LCS]= rotateAngles(RX_rot, DoA_theta_GCS, DoA_phi_GCS);
end


function [Theta2, Phi2] = angle_transformation(Rot, Theta, Phi)
function [Theta2, Phi2] = rotateAngles(Rot, Theta, Phi)

% Phi = wrapTo360(Phi);
Alpha = Rot(3);
Expand Down
File renamed without changes.
Loading

0 comments on commit 52a7a35

Please sign in to comment.