diff --git a/DeepMIMO_functions/find_users.m b/DeepMIMO_functions/find_users.m index 2c6e834..efcaf0b 100644 --- a/DeepMIMO_functions/find_users.m +++ b/DeepMIMO_functions/find_users.m @@ -1,5 +1,5 @@ % --------- DeepMIMO: A Generic Dataset for mmWave and massive MIMO ------% -% Authors: Ahmed Alkhateeb, Umut Demirhan, Abdelrahman Taha +% 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 @@ -8,32 +8,50 @@ function [users_ids, num_user] = find_users(params) rng(5); % For reproducibility with the same parameters - + user_grids = params.user_grids; start_of_grids = user_grids(:, 1); end_of_grids = user_grids(:, 2); users_per_row = user_grids(:, 3); - + if size(user_grids,2) == 4 + grids_orientation = user_grids(:, 4); % 0: The user row is defined parallel to x-axis + % 1: The user row is defined parallel to y-axis + num_of_grid_rows = ((end_of_grids-start_of_grids)+1); + else + grids_orientation = zeros(size(user_grids,1),1); + end + users_per_grid = ((end_of_grids-start_of_grids)+1).*users_per_row; - rows = [params.active_user_first:params.active_user_last]; + rows = params.active_user_first:params.active_user_last; num_of_subsampled_rows = round(length(rows)*params.row_subsampling); assert(num_of_subsampled_rows>=1, 'At least 1 row of users should be sampled! Please increase row subsampling rate.'); - rows = rows(randperm(length(rows),num_of_subsampled_rows)); - + + rows = sort(rows(randperm(length(rows),num_of_subsampled_rows))); prev_grids = rows > end_of_grids; id_from_prev_grids = sum(prev_grids .* users_per_grid, 1); curr_grids = rows >= start_of_grids & rows <= end_of_grids; - id_from_curr_grids = sum((rows - start_of_grids).*curr_grids.*users_per_row, 1); + + id_from_curr_grids_0 = sum((rows - start_of_grids).*curr_grids.*users_per_row, 1); %Assume all orientations = 0 + id_from_curr_grids_1 = sum((rows - start_of_grids).*curr_grids, 1); %Assume all orientations = 1 + id_from_curr_grids = (((grids_orientation.')*curr_grids).*id_from_curr_grids_1) + ((((1-grids_orientation).')*curr_grids).*id_from_curr_grids_0); + users = sum(id_from_prev_grids + id_from_curr_grids, 1); row_select = nonzeros(curr_grids.*users_per_row); + row_orientation = (grids_orientation.')*curr_grids; users_ids = []; + if size(user_grids,2) == 4 %Used only when an orientation flag = 1 + step_select_1 = nonzeros(curr_grids.*num_of_grid_rows); + end for i=1:length(row_select) - users_in_row = [1:row_select(i)]; + if ~row_orientation(i) %Orientation flag = 0 + users_in_row = 1:1:row_select(i); + else %Orientation flag = 1 + users_in_row = ( step_select_1(i)*( (1:1:row_select(i)) -1) ) +1; + end num_of_subsampled_users = round(length(users_in_row)*params.user_subsampling); - users_in_row = users_in_row(randperm(length(users_in_row), num_of_subsampled_users)); + users_in_row = sort(users_in_row(randperm(length(users_in_row), num_of_subsampled_users))); users_ids = [users_ids, users(i) + users_in_row]; end - users_ids = sort(users_ids); num_user = length(users_ids); end \ No newline at end of file diff --git a/DeepMIMO_functions/read_raytracing.m b/DeepMIMO_functions/read_raytracing.m index 8f208f2..8f51086 100644 --- a/DeepMIMO_functions/read_raytracing.m +++ b/DeepMIMO_functions/read_raytracing.m @@ -1,5 +1,5 @@ % --------- DeepMIMO: A Generic Dataset for mmWave and massive MIMO ------% -% Authors: Ahmed Alkhateeb, Umut Demirhan, Abdelrahman Taha +% Authors: Umut Demirhan, Abdelrahman Taha, Ahmed Alkhateeb % Date: March 17, 2022 % Goal: Encouraging research on ML/DL for MIMO applications and % providing a benchmarking tool for the developed algorithms @@ -41,6 +41,7 @@ dc = duration_check(params.symbol_duration); user_count = 1; +[~,user_order] = sort(user_ids); for Receiver_Number=1:user_last max_paths=double(DoD_array(pointer+2)); num_path_limited=double(min(num_paths,max_paths)); @@ -53,34 +54,34 @@ Relevant_DoA_array=DoA_array(pointer+3:pointer+2+Relevant_data_length); Relevant_CIR_array=CIR_array(pointer+3:pointer+2+Relevant_data_length); - channel_params_all(user_count).DoD_phi=Relevant_DoD_array(2:4:Relevant_limited_data_length); - channel_params_all(user_count).DoD_theta=Relevant_DoD_array(3:4:Relevant_limited_data_length); - channel_params_all(user_count).DoA_phi=Relevant_DoA_array(2:4:Relevant_limited_data_length); - channel_params_all(user_count).DoA_theta=Relevant_DoA_array(3:4:Relevant_limited_data_length); - channel_params_all(user_count).phase=Relevant_CIR_array(2:4:Relevant_limited_data_length); - channel_params_all(user_count).ToA=Relevant_CIR_array(3:4:Relevant_limited_data_length); - channel_params_all(user_count).power=1e-3*(10.^(0.1*( Relevant_CIR_array(4:4:Relevant_limited_data_length)+(transmit_power-tx_power_raytracing) ))); - channel_params_all(user_count).num_paths=num_path_limited; - channel_params_all(user_count).loc=Loc_array(Receiver_Number,2:4); - channel_params_all(user_count).distance=PL_array(Receiver_Number,1); - channel_params_all(user_count).pathloss=PL_array(Receiver_Number,2); - channel_params_all(user_count).LoS_status=LOS_array(Receiver_Number); + channel_params_all(user_order(user_count)).DoD_phi=Relevant_DoD_array(2:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).DoD_theta=Relevant_DoD_array(3:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).DoA_phi=Relevant_DoA_array(2:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).DoA_theta=Relevant_DoA_array(3:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).phase=Relevant_CIR_array(2:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).ToA=Relevant_CIR_array(3:4:Relevant_limited_data_length); + channel_params_all(user_order(user_count)).power=1e-3*(10.^(0.1*( Relevant_CIR_array(4:4:Relevant_limited_data_length)+(transmit_power-tx_power_raytracing) ))); + channel_params_all(user_order(user_count)).num_paths=num_path_limited; + channel_params_all(user_order(user_count)).loc=Loc_array(Receiver_Number,2:4); + channel_params_all(user_order(user_count)).distance=PL_array(Receiver_Number,1); + channel_params_all(user_order(user_count)).pathloss=PL_array(Receiver_Number,2); + channel_params_all(user_order(user_count)).LoS_status=LOS_array(Receiver_Number); - dc.add_ToA(channel_params_all(user_count).power, channel_params_all(user_count).ToA); + dc.add_ToA(channel_params_all(user_order(user_count)).power, channel_params_all(user_order(user_count)).ToA); else - channel_params_all(user_count).DoD_phi=[]; - channel_params_all(user_count).DoD_theta=[]; - channel_params_all(user_count).DoA_phi=[]; - channel_params_all(user_count).DoA_theta=[]; - channel_params_all(user_count).phase=[]; - channel_params_all(user_count).ToA=[]; - channel_params_all(user_count).power=[]; - channel_params_all(user_count).num_paths=0; - channel_params_all(user_count).loc=Loc_array(Receiver_Number,2:4); - channel_params_all(user_count).distance=PL_array(Receiver_Number,1); - channel_params_all(user_count).pathloss=[]; - channel_params_all(user_count).LoS_status=LOS_array(Receiver_Number); + channel_params_all(user_order(user_count)).DoD_phi=[]; + channel_params_all(user_order(user_count)).DoD_theta=[]; + channel_params_all(user_order(user_count)).DoA_phi=[]; + channel_params_all(user_order(user_count)).DoA_theta=[]; + channel_params_all(user_order(user_count)).phase=[]; + channel_params_all(user_order(user_count)).ToA=[]; + channel_params_all(user_order(user_count)).power=[]; + channel_params_all(user_order(user_count)).num_paths=0; + channel_params_all(user_order(user_count)).loc=Loc_array(Receiver_Number,2:4); + channel_params_all(user_order(user_count)).distance=PL_array(Receiver_Number,1); + channel_params_all(user_order(user_count)).pathloss=[]; + channel_params_all(user_order(user_count)).LoS_status=LOS_array(Receiver_Number); end user_count = double(user_count + 1); end