Skip to content

Commit

Permalink
Changes on the SR implementation. This version has been verified agai…
Browse files Browse the repository at this point in the history
…nst Komondor v3.0 (https://github.com/wn-upf/Komondor/releases/tag/v3.0). An example is provided for an initial execution.
  • Loading branch information
Francisco Wilhelmi authored and Francisco Wilhelmi committed Jul 9, 2019
1 parent 1401676 commit a89594e
Show file tree
Hide file tree
Showing 43 changed files with 831 additions and 844 deletions.
573 changes: 0 additions & 573 deletions console_logs.txt

This file was deleted.

Binary file removed constants.mat
Binary file not shown.
43 changes: 43 additions & 0 deletions source/SIMULATION_EXAMPLE.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%%% ***********************************************************************
%%% * *
%%% * Spatial Reuse Operation in IEEE 802.11ax: *
%%% * Analysis, Challenges and Research Opportunities *
%%% * *
%%% * Submission to IEEE Surveys & Tutorials *
%%% * *
%%% * Authors: *
%%% * - Francesc Wilhelmi ([email protected]) *
%%% * - Sergio Barrachina-Muñoz ([email protected]) *
%%% * - Boris Bellalta ([email protected]) *
%%% * - Cristina Cano ([email protected]) *
%%% * - Ioannis Selinis ([email protected]) *
%%% * *
%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
%%% * *
%%% * Repository: *
%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
%%% ***********************************************************************

%% PART 1 - Generate the data
clear
clc

% Generate constants
constants_sfctmn_framework
% Set specific configurations
configuration_system

% Generate wlans object according to the input file
input_file = 'input_example_spatial_reuse.csv';
wlans = generate_wlan_from_file(input_file, false, false, 1, [], []);

% Compute the throughput of the scenario, for each OBSS_PD value
disp('---------------------------')
disp([' OBSS/PD (WLAN A) = -78 dBm / Tx Power (WLAN A) = 20 dBm'])
disp('---------------------------')
% Set the OBSS_PD to be used by WLAN A
wlans(1).non_srg_obss_pd = -78;
% Call the SFCTMN framework
[throughput] = function_main_sfctmn(wlans);
disp(['Throughput WLAN A in Test scenario: ' num2str(throughput(1))])
disp(['Throughput WLAN B in Test scenario: ' num2str(throughput(2))])
3 changes: 3 additions & 0 deletions source/input_example_spatial_reuse.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
% code; primary; left ch; right ch; tx_power; cca; lambda; x_ap; y_ap; z_ap; x_sta; y_sta; z_sta; legacy_node; cw;non_srg_activated;srg;non_srg_obss_pd;srg_obss_pd;tx_pwr_ref
1;1;1;1;20;-82;14815;0;4;0;0;0;0;0;512;1;0;-80;-75;21
2;1;1;1;20;-82;14815;6;4;0;6;8;0;0;512;0;0;-80;-75;21
10 changes: 4 additions & 6 deletions source/sfctm/MatlabSim11ax/PHYParams80211ax.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

% Header ------

load('constants.mat');
load('constants_sfctmn_framework.mat');

% Physical Header (HE SU Format)
Legacy_PHYH = 20E-6;
Expand All @@ -25,11 +25,9 @@
case 80
Nsc = 980;
case 160
Nsc = 1960;

Nsc = 1960;
otherwise
Nsc = -1;

Nsc = -1;
end

% Modulation and Coding Scheme (MCS) - Without DCM!!!
Expand Down Expand Up @@ -77,5 +75,5 @@
Yc = -1;
end
% Duration of OFDM symbol (CP of 3.2us is included)
T_OFDM = 16E-6;
T_OFDM = 4E-6;
end
91 changes: 63 additions & 28 deletions source/sfctm/MatlabSim11ax/SUtransmission80211ax.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,68 @@

% RTS + SIFS + CTS + DATA + SIFS + ACK + DIFS + Te

function [T,T_c]=SUtransmission80211ax(L,Na,W,SUSS,MCSindex)

% Load 802.11ax parameters

%% MAC
[DIFS,SIFS,Te,L_MACH,L_BACK,L_RTS,L_CTS,L_SF,L_DEL,L_TAIL]=MACParams80211ax();

%% PHY
[Nsc,Ym,Yc,T_OFDM,Legacy_PHYH,HE_PHYH]=PHYParams80211ax(W,MCSindex,SUSS);

Rate = Nsc * Ym * Yc * SUSS;
Rate_20MHz = 52 * Ym * Yc; % In legacy mode

%disp([Nsc Ym Yc]);

% Duplicate RTS/CTS for bandwidth allocation
T_RTS = Legacy_PHYH + ceil((L_SF+L_RTS+L_TAIL)/Rate_20MHz)*T_OFDM;
T_CTS = Legacy_PHYH + ceil((L_SF+L_CTS+L_TAIL)/Rate_20MHz)*T_OFDM;

% After successful acquisition of the channel
T_DATA = (Legacy_PHYH + HE_PHYH) + ceil((L_SF+Na*(L_DEL+L_MACH+L)+L_TAIL)/Rate)*T_OFDM;
T_BACK = Legacy_PHYH + ceil((L_SF+L_BACK+L_TAIL)/Rate_20MHz)*T_OFDM;

% Successful slot
T = T_RTS + SIFS + T_CTS + SIFS + T_DATA + SIFS + T_BACK + DIFS + Te; % (Implicit BACK request)

% Collision slot
T_c = T_RTS + SIFS + T_CTS + DIFS + Te;
function [T, limited_num_packets_aggregated, T_c]=SUtransmission80211ax(L,Na,W,SUSS,MCSindex,TimeoutFlag)



if MCSindex == -1

T = 0;
limited_num_packets_aggregated = 0;
T_c = 0;

else

% Load 802.11ax parameters
IEEE_AX_PHY_HE_SU_DURATION = 100e-6;
IEEE_AX_MD_LENGTH = 32;
IEEE_AX_MH_LENGTH = 320;
IEEE_AX_OFDM_SYMBOL_GI32_DURATION = 16e-6;
IEEE_AX_MAX_PPDU_DURATION = 5484e-6;

%% MAC
[DIFS,SIFS,Te,L_MACH,L_BACK,L_RTS,L_CTS,L_SF,L_DEL,L_TAIL]=MACParams80211ax();

%% PHY
[Nsc,Ym,Yc,T_OFDM,Legacy_PHYH,HE_PHYH]=PHYParams80211ax(W,MCSindex,SUSS);
bits_ofdm_sym_legacy = 24;
bits_ofdm_sym = Nsc * Ym * Yc * SUSS;
% Rate = Nsc * Ym * Yc * SUSS;
% Rate_20MHz = 52 * Ym * Yc; % In legacy mode

%disp([Nsc Ym Yc]);

% Duplicate RTS/CTS for bandwidth allocation
T_RTS = Legacy_PHYH + ceil((L_SF+L_RTS)/bits_ofdm_sym_legacy)*T_OFDM;
T_CTS = Legacy_PHYH + ceil((L_SF+L_CTS)/bits_ofdm_sym_legacy)*T_OFDM;

if(TimeoutFlag)
T = T_RTS + DIFS;
else
% LIMIT OF THE NUMBER OF AGG PACKETS
limited_num_packets_aggregated = Na;
while (limited_num_packets_aggregated > 0)
T_DATA = IEEE_AX_PHY_HE_SU_DURATION + ceil((L_SF + limited_num_packets_aggregated ...
* (IEEE_AX_MD_LENGTH + IEEE_AX_MH_LENGTH + L)) / bits_ofdm_sym) * IEEE_AX_OFDM_SYMBOL_GI32_DURATION;
if(T_DATA <= IEEE_AX_MAX_PPDU_DURATION)
break;
else
limited_num_packets_aggregated = limited_num_packets_aggregated - 1;
end
end
% After successful acquisition of the channel
% T_DATA = IEEE_AX_PHY_HE_SU_DURATION + ceil((L_SF + limited_num_packets_aggregated * ...
% (IEEE_AX_MD_LENGTH + IEEE_AX_MH_LENGTH + L)) / bits_ofdm_sym) * IEEE_AX_OFDM_SYMBOL_GI32_DURATION;

T_BACK = 32e-6;%Legacy_PHYH + ceil((L_SF+L_BACK+L_TAIL)/Rate_20MHz)*T_OFDM;

% Successful slot
T = T_RTS + SIFS + T_CTS + SIFS + T_DATA + SIFS + T_BACK + DIFS + Te; % (Implicit BACK request)

% Collision slot
T_c = T_RTS + SIFS + T_CTS + DIFS + Te;
end

end

end
2 changes: 1 addition & 1 deletion source/sfctm/apply_power_restriction.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
% Output:
% -

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace
%load('configuration_system.mat'); % Load constants into workspace

limited_tx_power = zeros (1, size(cca_values, 2));
Expand Down
Empty file modified source/sfctm/arrow.m
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion source/sfctm/check_input_config.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
% Output:
% - is_config_ok: (deprecated) boolean for identifying if configuration is properly entered.

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace

is_config_ok = true;

Expand Down
78 changes: 38 additions & 40 deletions source/sfctm/compute_mcs.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function mcs_per_wlan = compute_mcs(power_from_ap_cell, num_channels_system)
function mcs_per_wlan = compute_mcs(PSI_cell, power_from_ap_cell, num_channels_system)
% MCS_PER_WLAN computes the allowed Modulation Coding Scheme for each WLAN
% transmitting in different number of channels
% INPUT:
Expand All @@ -8,52 +8,50 @@
% * mcs_per_wlan: MCS in each WLAN for each number of channels used for tx
% (rows: number of channels, columns: MCS index)

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace

mcs_per_wlan = {};
mcs_per_wlan = cell(1, size(power_from_ap_cell, 2));

for state_ix = 1 : size(power_from_ap_cell, 2)

for state_ix = 1 : size(power_from_ap_cell, 2)
power_state_ix = power_from_ap_cell{state_ix};
num_wlans = size(power_from_ap_cell{state_ix}, 1);
mcs_per_wlan{state_ix} = zeros(num_wlans, num_channels_system);

mcs_per_wlan{state_ix} = zeros(num_wlans, num_channels_system);
for wlan_ix = 1 : num_wlans

for ch_ix = 1 : num_channels_system%(log2(num_channels_system) + 1) % For 1, 2, 4 and 8 channels

if power_state_ix(wlan_ix,ch_ix) < -82 +((ch_ix-1)*3)
for ch_ix = 1 : num_channels_system %(log2(num_channels_system) + 1) % For 1, 2, 4 and 8 channels
if PSI_cell{state_ix}(wlan_ix) > 0
if power_state_ix(wlan_ix,ch_ix) < -82 +((ch_ix-1)*3)
%mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_FORBIDDEN;
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_BPSK_1_2; % Default MCS (to always start the TX)
elseif (power_state_ix(wlan_ix,ch_ix) >= -82 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -79 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_BPSK_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -79 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -77 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_QPSK_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -77 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -74 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_QPSK_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -74 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -70 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_16QAM_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -70 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -66 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_16QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -66 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -65 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_2_3;
elseif (power_state_ix(wlan_ix,ch_ix) >= -65 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -64 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -64 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -59 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_5_6;
elseif (power_state_ix(wlan_ix,ch_ix) >= -59 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -57 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_256QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -57 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -54 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_256QAM_5_6;
elseif (power_state_ix(wlan_ix,ch_ix) >= -54 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -52 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_1024QAM_3_4;
else
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_1024QAM_5_6;
end
else % If the WLAN is not transmitting in state "state_ix"
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_FORBIDDEN;
elseif (power_state_ix(wlan_ix,ch_ix) >= -82 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -79 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_BPSK_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -79 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -77 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_QPSK_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -77 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -74 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_QPSK_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -74 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -70 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_16QAM_1_2;
elseif (power_state_ix(wlan_ix,ch_ix) >= -70 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -66 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_16QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -66 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -65 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_2_3;
elseif (power_state_ix(wlan_ix,ch_ix) >= -65 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -64 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -64 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -59 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_64QAM_5_6;
elseif (power_state_ix(wlan_ix,ch_ix) >= -59 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -57 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_256QAM_3_4;
elseif (power_state_ix(wlan_ix,ch_ix) >= -57 + ((ch_ix-1)*3) && power_state_ix(wlan_ix,ch_ix) < -54 +((ch_ix-1)*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_256QAM_5_6;
elseif (power_state_ix(wlan_ix,ch_ix) >= -54 + (ch_ix*3) && power_state_ix(wlan_ix,ch_ix) < -52 +(ch_ix*3))
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_1024QAM_3_4;
else
mcs_per_wlan{state_ix}(wlan_ix, ch_ix) = MODULATION_1024QAM_5_6;
end

end

end

end
end
end

end
2 changes: 1 addition & 1 deletion source/sfctm/compute_node_com_range.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
% Returned parameters:
% - d_max: Max distance reachable [m]

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace

switch path_loss_model
case PATH_LOSS_FREE_SPACE
Expand Down
2 changes: 1 addition & 1 deletion source/sfctm/compute_power_received.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
% Output:
% - power_rx: power received [dBm]

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace

switch path_loss_model

Expand Down
11 changes: 7 additions & 4 deletions source/sfctm/compute_sensed_power.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
% - carrier_frequency: carrier frequency
% - Power_from_AP: power that each STA receives from its AP (in dBm)

load('constants.mat'); % Load constants into workspace
load('system_conf.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace
load('configuration_system.mat'); % Load constants into workspace

num_wlans = length(wlans); % Number of WLANs
[distance_ap_ap, distance_ap_sta] = compute_distance_nodes(wlans); % distances between APs and STAs
Expand Down Expand Up @@ -69,8 +69,11 @@
tx_power(wlan_ix) = min(TX_POWER_MAX, wlans(wlan_ix).tx_power - 3 * (num_channels - 1));
if power_restriction_activated{psi_ix}(wlan_ix) == 1
% - Apply power restriction
tx_power_max = min(TX_POWER_MAX , wlans(wlan_ix).tx_pwr_ref ...
- (power_detection_threshold(wlan_ix) - OBSS_PD_MIN) - 3 * (num_channels - 1));
tx_power_max = apply_tx_power_restriction( ...
power_detection_threshold(wlan_ix), wlans(wlan_ix).tx_pwr_ref, ...
TX_POWER_MAX, OBSS_PD_MIN, num_channels );
% tx_power_max = min(TX_POWER_MAX , wlans(wlan_ix).tx_pwr_ref ...
% - (power_detection_threshold(wlan_ix) - OBSS_PD_MIN) - 3 * (num_channels - 1));
if tx_power_max < tx_power(wlan_ix)
tx_power(wlan_ix) = tx_power_max;
end
Expand Down
Empty file modified source/sfctm/compute_sinr.m
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion source/sfctm/compute_tx_rate_according_to_sinr.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
% Output:
% - Power_from_AP: array of power sensed in the STA from its AP (in dBm)

load('constants.mat'); % Load constants into workspace
load('constants_sfctmn_framework.mat'); % Load constants into workspace

if n_channels > 0 && SINR > 0
tx_rate = n_channels * CHANNEL_WIDTH * log2(1 + db2pow(SINR));
Expand Down
36 changes: 36 additions & 0 deletions source/sfctm/configuration_system.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%%% ***********************************************************************
%%% * *
%%% * Spatial Reuse Operation in IEEE 802.11ax: *
%%% * Analysis, Challenges and Research Opportunities *
%%% * *
%%% * Submission to IEEE Surveys & Tutorials *
%%% * *
%%% * Authors: *
%%% * - Francesc Wilhelmi ([email protected]) *
%%% * - Sergio Barrachina-Muñoz ([email protected]) *
%%% * - Boris Bellalta ([email protected]) *
%%% * - Cristina Cano ([email protected]) *
%%% * - Ioannis Selinis ([email protected]) *
%%% * *
%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
%%% * *
%%% * Repository: *
%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
%%% ***********************************************************************

%%% File description: script for generating the system configuration

path_loss_model = PATH_LOSS_AX_RESIDENTIAL; % Path loss model index
access_protocol_type = ACCESS_PROTOCOL_SR_SINGLE_CHANNEL; % Access protocol type
flag_hardcode_distances = false; % Allows hardcoding distances from main_sfctmn.m file
carrier_frequency = 5; % Carrier frequency [GHz] (2.4 or 5) GHz
NOISE_DBM = -95; % Ambient noise [dBm]
BANDWITDH_PER_CHANNEL = 20e6; % Bandwidth per channel [MHz]
SINGLE_USER_SPATIAL_STREAMS = 1; % Number of spatial streams
IEEE_AX_MAX_PPDU_DURATION = 5484 * 0.000001;

% DSA policy type (SFCTMN)
dsa_policy_type = DSA_POLICY_ONLY_PRIMARY_SPATIAL_REUSE;
num_channels = 1;

save('configuration_system.mat'); % Save system configuration into current folder
Loading

0 comments on commit a89594e

Please sign in to comment.