diff --git a/console_logs.txt b/console_logs.txt
deleted file mode 100644
index 4cf0775..0000000
--- a/console_logs.txt
+++ /dev/null
@@ -1,573 +0,0 @@
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-{Undefined function or variable 'generate_wlan_from_file'.
-
-Error in main_sfctmn (line 48)
-wlans = generate_wlan_from_file(input_file, false, false, 1, [], []);
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/main_sfctmn.m',48,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
-{Reference to non-existent field 'bss_color'.
-
-Error in display_wlans (line 43)
- disp([LOG_LVL5 'BSS color: ' num2str(wlans(wlan_ix).bss_color)])
-
-Error in main_sfctmn (line 76)
-display_wlans(wlans, flag_display_wlans, flag_plot_wlans, ...
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/display_wlans.m',43,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
-{Reference to non-existent field 'obss_pd'.
-
-Error in display_wlans (line 44)
- disp([LOG_LVL5 'OBSS_PD: ' num2str(wlans(wlan_ix).obss_pd)])
-
-Error in main_sfctmn (line 76)
-display_wlans(wlans, flag_display_wlans, flag_plot_wlans, ...
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/display_wlans.m',44,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-{Undefined function or variable 'check_wlans_types'.
-
-Error in identify_feasible_states_and_Q (line 54)
- wlans_types = check_wlans_types(wlans);
-
-Error in main_sfctmn (line 112)
-[ Q, S, S_cell, Q_logical_S, Q_logical_PSI, S_num_states, new_mcs_per_wlan_per_state ] =
-identify_feasible_states_and_Q(...
-}
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-{Undefined function or variable 'SUtransmission80211ax'.
-
-Error in identify_feasible_states_and_Q (line 126)
- mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
-
-Error in main_sfctmn (line 112)
-[ Q, S, S_cell, Q_logical_S, Q_logical_PSI, S_num_states, new_mcs_per_wlan_per_state ] =
-identify_feasible_states_and_Q(...
-}
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
-{Error using load
-'constants_sfctmn_framework.mat' is not found in the current folder or on the MATLAB path, but exists in:
- /home/administrador/workspace
- /home/administrador/workspace/overview_ieee80211ax_spatial_reuse/Code_modified_SR
-
-Change the MATLAB current folder or add its folder to the MATLAB path.
-
-Error in main_sfctmn (line 37)
-load('constants_sfctmn_framework.mat') % Execute constants_script.m script to store constants in the workspace
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/main_sfctmn.m',37,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-{Error using load
-'system_conf.mat' is not found in the current folder or on the MATLAB path, but exists in:
- /home/administrador/workspace
-
-Change the MATLAB current folder or add its folder to the MATLAB path.
-
-Error in main_sfctmn (line 43)
-load('system_conf.mat'); % Load constants into workspace
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/main_sfctmn.m',43,0)
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/main_sfctmn.m',43,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-System configuration saved in file system_conf.mat
- + System configuration loaded!
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-- System configuration
- + Access protocol: IE802.11
- + DSA policy: OnlyMax
- + Path loss model: 8011ax Res.
- + Carrier frequency: 5e-09 GHz
-
-Identifying global state space (PSI)...
-- Global states identified! There are 16 global states.
-
-Computing interference sensed power by the STAs in every state (Power_PSI). It may take some minutes :) ...
-- Sensed power computed!
-
-Identifying feasible state space (S) and transition rate matrix (Q)...
-{Error using load
-'constants_sfctmn_framework.mat' is not found in the current folder or on the MATLAB path, but exists in:
- /home/administrador/workspace
- /home/administrador/workspace/overview_ieee80211ax_spatial_reuse/Code_modified_SR
-
-Change the MATLAB current folder or add its folder to the MATLAB path.
-
-Error in PHYParams80211ax (line 6)
- load('constants_sfctmn_framework.mat');
-
-Error in SUtransmission80211ax (line 21)
- [Nsc,Ym,Yc,T_OFDM,Legacy_PHYH,HE_PHYH]=PHYParams80211ax(W,MCSindex,SUSS);
-
-Error in identify_feasible_states_and_Q (line 126)
- mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
-
-Error in main_sfctmn (line 112)
-[ Q, S, S_cell, Q_logical_S, Q_logical_PSI, S_num_states, new_mcs_per_wlan_per_state ] =
-identify_feasible_states_and_Q(...
-}
-opentoline('/home/administrador/workspace/SFCTMN/source/sfctm/MatlabSim11ax/PHYParams80211ax.m',6,0)
-main_sfctmn
-
-*********************************************************************
-* Spatial-Flexible CTMN for WLANs *
-* Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-* GitHub repository: https://github.com/sergiobarra/SFCTMN *
-* More info on https://www.upf.edu/en/web/sergiobarrachina *
-*********************************************************************
-
-Setting framework up...
-- Loading constant variables...
- + Constants loaded!
-- Loading system configuration...
-System configuration saved in file system_conf.mat
- + System configuration loaded!
-Processing input CSV...
- + Checking input configuration...
- - WLANs input file processed successfully!
- + WLANS input info:
- - wlan A:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (0, 4, 0) m
- - sta: (0, 0, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 1
- + non-SRG OBSS_PD: -75
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
- - wlan B:
- + primary channel: 1
- + channel range: 1 - 1
- + positions:
- - ap: (6, 4, 0) m
- - sta: (6, 8, 0) m
- + Transmission power: 20 dBm
- + CCA level: -82 dBm
- + lambda: 14815 packets/s
- + SRG: 2
- + non-SRG OBSS_PD: -82
- + SRG OBSS_PD: -82
- + TX PWR REF: 21
-- System configuration
- + Access protocol: IE802.11
- + DSA policy: OnlyMax
- + Path loss model: 8011ax Res.
- + Carrier frequency: 5e-09 GHz
-
-Identifying global state space (PSI)...
-- Global states identified! There are 16 global states.
-
-Computing interference sensed power by the STAs in every state (Power_PSI). It may take some minutes :) ...
-- Sensed power computed!
-
-Identifying feasible state space (S) and transition rate matrix (Q)...
-- Feasible state space (S) identified! There are 5 feasible states.
-
-Solving pi * Q = 0 ...
-- Equilibrium distribution found! Prob. of being in each possible state:
- 0.0000 0.0049 0.0025 0.9878 0.0048
-
-- Reversible Markov chain? 0 (error: 1.4215)
-- Dominant state: s4 (with probability 0.98777)
-
-Computing throughput...
-- Throughput computed!
-
-
-***** DISPLAYING RESULTS *****
-
-- GLOBAL states (PSI):
-PSI(1)
- 0
- 0
-
-PSI(2)
- 0
- 1
-
-PSI(3)
- 0
- 2
-
-PSI(4)
- 0
- 3
-
-PSI(5)
- 1
- 0
-
-PSI(6)
- 1
- 1
-
-PSI(7)
- 1
- 2
-
-PSI(8)
- 1
- 3
-
-PSI(9)
- 2
- 0
-
-PSI(10)
- 2
- 1
-
-PSI(11)
- 2
- 2
-
-PSI(12)
- 2
- 3
-
-PSI(13)
- 3
- 0
-
-PSI(14)
- 3
- 1
-
-PSI(15)
- 3
- 2
-
-PSI(16)
- 3
- 3
-
-
-- PSI logical transition matrix (Q_logical_PSI)
- 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0
- 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
- 0 2 0 0 0 0 0 0 2 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
-
-- FEASIBLE states (S). Number of states :5
-S(1)
- 0
- 0
-
-S(2)
- 1
- 0
-
-S(3)
- 0
- 1
-
-S(4)
- 2
- 1
-
-S(5)
- 2
- 0
-
-- Plotting PSI CTMC...
- + Plotted!
-- Plotting S CTMC...
- + Plotted!
-Finished!
diff --git a/constants.mat b/constants.mat
deleted file mode 100644
index 0e734ae..0000000
Binary files a/constants.mat and /dev/null differ
diff --git a/source/SIMULATION_EXAMPLE.m b/source/SIMULATION_EXAMPLE.m
new file mode 100644
index 0000000..c8bb6a1
--- /dev/null
+++ b/source/SIMULATION_EXAMPLE.m
@@ -0,0 +1,43 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * 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))])
\ No newline at end of file
diff --git a/source/input_example_spatial_reuse.csv b/source/input_example_spatial_reuse.csv
new file mode 100644
index 0000000..f304a10
--- /dev/null
+++ b/source/input_example_spatial_reuse.csv
@@ -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
\ No newline at end of file
diff --git a/source/sfctm/MatlabSim11ax/PHYParams80211ax.m b/source/sfctm/MatlabSim11ax/PHYParams80211ax.m
index 1834fc4..b101389 100644
--- a/source/sfctm/MatlabSim11ax/PHYParams80211ax.m
+++ b/source/sfctm/MatlabSim11ax/PHYParams80211ax.m
@@ -3,7 +3,7 @@
% Header ------
- load('constants.mat');
+ load('constants_sfctmn_framework.mat');
% Physical Header (HE SU Format)
Legacy_PHYH = 20E-6;
@@ -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!!!
@@ -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
\ No newline at end of file
diff --git a/source/sfctm/MatlabSim11ax/SUtransmission80211ax.m b/source/sfctm/MatlabSim11ax/SUtransmission80211ax.m
index 7b05280..e58ba77 100644
--- a/source/sfctm/MatlabSim11ax/SUtransmission80211ax.m
+++ b/source/sfctm/MatlabSim11ax/SUtransmission80211ax.m
@@ -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
\ No newline at end of file
diff --git a/source/sfctm/apply_power_restriction.m b/source/sfctm/apply_power_restriction.m
index da4a263..89c9bfa 100644
--- a/source/sfctm/apply_power_restriction.m
+++ b/source/sfctm/apply_power_restriction.m
@@ -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));
diff --git a/source/sfctm/arrow.m b/source/sfctm/arrow.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/check_input_config.m b/source/sfctm/check_input_config.m
old mode 100755
new mode 100644
index 96c5a24..25799b8
--- a/source/sfctm/check_input_config.m
+++ b/source/sfctm/check_input_config.m
@@ -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;
diff --git a/source/sfctm/compute_mcs.m b/source/sfctm/compute_mcs.m
index 950bdc3..3b6a87c 100644
--- a/source/sfctm/compute_mcs.m
+++ b/source/sfctm/compute_mcs.m
@@ -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:
@@ -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
\ No newline at end of file
diff --git a/source/sfctm/compute_node_com_range.m b/source/sfctm/compute_node_com_range.m
old mode 100755
new mode 100644
index 64a60a3..bfb7f62
--- a/source/sfctm/compute_node_com_range.m
+++ b/source/sfctm/compute_node_com_range.m
@@ -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
diff --git a/source/sfctm/compute_power_received.m b/source/sfctm/compute_power_received.m
old mode 100755
new mode 100644
index a33a7f9..e6e2741
--- a/source/sfctm/compute_power_received.m
+++ b/source/sfctm/compute_power_received.m
@@ -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
diff --git a/source/sfctm/compute_sensed_power.m b/source/sfctm/compute_sensed_power.m
index d220426..5a2ed0e 100644
--- a/source/sfctm/compute_sensed_power.m
+++ b/source/sfctm/compute_sensed_power.m
@@ -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
@@ -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
diff --git a/source/sfctm/compute_sinr.m b/source/sfctm/compute_sinr.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/compute_tx_rate_according_to_sinr.m b/source/sfctm/compute_tx_rate_according_to_sinr.m
index 446be22..403ac77 100644
--- a/source/sfctm/compute_tx_rate_according_to_sinr.m
+++ b/source/sfctm/compute_tx_rate_according_to_sinr.m
@@ -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));
diff --git a/source/sfctm/configuration_system.m b/source/sfctm/configuration_system.m
new file mode 100644
index 0000000..67d9728
--- /dev/null
+++ b/source/sfctm/configuration_system.m
@@ -0,0 +1,36 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * 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
\ No newline at end of file
diff --git a/source/sfctm/constants_script.m b/source/sfctm/constants_sfctmn_framework.m
old mode 100755
new mode 100644
similarity index 94%
rename from source/sfctm/constants_script.m
rename to source/sfctm/constants_sfctmn_framework.m
index 94bf2a3..c3efd49
--- a/source/sfctm/constants_script.m
+++ b/source/sfctm/constants_sfctmn_framework.m
@@ -11,16 +11,16 @@
% Framework configuration. Booleans for activating specific functionalities
% - General settings
-flag_save_console_logs = true; % Flag for saving the console logs in a text file
+flag_save_console_logs = false; % Flag for saving the console logs in a text file
flag_save_results = false; % Flag for saving the results
% - General logs
-flag_general_logs = true;
+flag_general_logs = false;
% - Display
-flag_display_PSI_states = true; % Flag for displaying PSI's CTMC states
-flag_display_S_states = true; % Flag for displaying S' CTMC states
-flag_display_wlans = true; % Flag for displaying WLANs' input info
+flag_display_PSI_states = false; % Flag for displaying PSI's CTMC states
+flag_display_S_states = false; % Flag for displaying S' CTMC states
+flag_display_wlans = false; % Flag for displaying WLANs' input info
flag_display_Power_PSI = false; % Flag for displaying sensed powers
flag_display_Q_logical = false; % Flag for displaying logical transition rate matrix
flag_display_Q = false; % Flag for displaying transition rate matrix
@@ -28,9 +28,9 @@
% - Plots
flag_plot_PSI_ctmc = true; % Flag for plotting PSI's CTMC
-flag_plot_S_ctmc = true; % Flag for plotting S' CTMC
+flag_plot_S_ctmc = false; % Flag for plotting S' CTMC
flag_plot_wlans = true; % Flag for plotting WLANs' distribution
-flag_plot_ch_allocation = true; % Flag for plotting WLANs' channel allocation
+flag_plot_ch_allocation = false; % Flag for plotting WLANs' channel allocation
flag_plot_throughput = true; % Flag for plotting the throughput
% - Logs
@@ -181,4 +181,4 @@
STATE_NONSRG_ACTIVATED = 2;
STATE_SRG_ACTIVATED = 3;
-save('constants.mat'); % Save constants into current folder
\ No newline at end of file
+save('constants_sfctmn_framework.mat'); % Save constants into current folder
\ No newline at end of file
diff --git a/source/sfctm/create_global_states.m b/source/sfctm/create_global_states.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/display_wlans.m b/source/sfctm/display_wlans.m
old mode 100755
new mode 100644
index e1b5aa6..190e193
--- a/source/sfctm/display_wlans.m
+++ b/source/sfctm/display_wlans.m
@@ -18,7 +18,7 @@
% - path_loss_model: path loss model
% - carrier_frequency: carrier frequency
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
num_wlans = length(wlans); % Number of WLANs in the system
@@ -40,9 +40,11 @@
disp([LOG_LVL5 'Transmission power: ' num2str(wlans(wlan_ix).tx_power) ' dBm'])
disp([LOG_LVL5 'CCA level: ' num2str(wlans(wlan_ix).cca) ' dBm'])
disp([LOG_LVL5 'lambda: ' num2str(wlans(wlan_ix).lambda) ' packets/s'])
+ disp([LOG_LVL5 'BSS color: ' num2str(wlans(wlan_ix).bss_color)])
disp([LOG_LVL5 'SRG: ' num2str(wlans(wlan_ix).srg)])
- disp([LOG_LVL5 'non-SRG OBSS_PD: ' num2str(wlans(wlan_ix).non_srg_obss_pd)])
+ disp([LOG_LVL5 'OBSS_PD: ' num2str(wlans(wlan_ix).obss_pd)])
disp([LOG_LVL5 'SRG OBSS_PD: ' num2str(wlans(wlan_ix).srg_obss_pd)])
+ disp([LOG_LVL5 'non-SRG OBSS_PD: ' num2str(wlans(wlan_ix).non_srg_obss_pd)])
disp([LOG_LVL5 'TX PWR REF: ' num2str(wlans(wlan_ix).tx_pwr_ref)])
end
diff --git a/source/sfctm/find_forward_states.m b/source/sfctm/find_forward_states.m
index 12c847e..37bad4c 100644
--- a/source/sfctm/find_forward_states.m
+++ b/source/sfctm/find_forward_states.m
@@ -20,7 +20,7 @@
% - psi_forward: state (or states) to transit forward to
% - alpha: array of transition rate tunning parameters
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
% Number of possible states to transit forward
num_possible_forward_states = length(possible_forward_states(:,1));
diff --git a/source/sfctm/find_possible_forward_states.m b/source/sfctm/find_possible_forward_states.m
index 67d1871..08b7f0a 100644
--- a/source/sfctm/find_possible_forward_states.m
+++ b/source/sfctm/find_possible_forward_states.m
@@ -23,7 +23,7 @@
% Output:
% - possible_forward_states: array with the potential forward states
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
possible_forward_states = [];
for psi_ix = 1 : num_global_states % Foreach state psi in PSI
diff --git a/source/sfctm/find_state_in_set.m b/source/sfctm/find_state_in_set.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/function_main_sfctmn.m b/source/sfctm/function_main_sfctmn.m
index eca9628..46ae9a3 100644
--- a/source/sfctm/function_main_sfctmn.m
+++ b/source/sfctm/function_main_sfctmn.m
@@ -16,7 +16,7 @@
% Display framework header
% type 'sfctmn_header.txt'
%% FRAMEWORK CONFIGURATION
- constants_script
+ constants_sfctmn_framework
if flag_save_console_logs
diary('console_logs.txt') % Save logs in a text file
@@ -83,20 +83,22 @@
Power_Detection_PSI_cell, Interest_Power_PSI_cell, Individual_Power_AP_PSI_cell] = ...
compute_sensed_power(wlans, num_global_states, PSI_cell, path_loss_model, carrier_frequency, num_channels);
display_with_flag([LOG_LVL2 'Sensed power computed!'], flag_general_logs)
-
-
+
%% Modulation and Coding Scheme
% Compute the MCS according to the SINR in isolation mode
- mcs_per_wlan_per_state = compute_mcs(Interest_Power_PSI_cell, num_channels);
-
+ mcs_per_wlan_per_state = compute_mcs(PSI_cell, Interest_Power_PSI_cell, num_channels);
+
%% FEASIBLE STATES SPACE (S)
% Identify feasible states space (S) according to spatial and spectrum requirements.
display_with_flag(' ', flag_general_logs)
display_with_flag([LOG_LVL1 'Identifying feasible state space (S) and transition rate matrix (Q)...'], flag_general_logs)
[ Q, S, S_cell, Q_logical_S, Q_logical_PSI, S_num_states, new_mcs_per_wlan_per_state ] = identify_feasible_states_and_Q(...
- PSI_cell, Power_AP_PSI_cell, Power_Detection_PSI_cell, Individual_Power_AP_PSI_cell, num_channels, wlans, mcs_per_wlan_per_state, flag_logs_feasible_space);
+ PSI_cell, Power_AP_PSI_cell, Power_Detection_PSI_cell, Individual_Power_AP_PSI_cell, num_channels, wlans, mcs_per_wlan_per_state, ...
+ Interest_Power_PSI_cell, SINR_cell, flag_logs_feasible_space);
display_with_flag([LOG_LVL2 'Feasible state space (S) identified! There are ' num2str(S_num_states) ' feasible states.'], flag_general_logs)
-
+
+ %Q
+
%% MARKOV CHAIN
% Solve Markov Chain from equilibrium distribution
display_with_flag(' ', flag_general_logs)
@@ -104,8 +106,9 @@
% Equilibrium distribution array (pi). Element s is the probability of being in state s.
% - The left null space of Q is equivalent to solve [pi] * Q = [0 0 ... 0 1]
- p_equilibrium = mrdivide([zeros(1,size(Q,1)) 1],[Q ones(size(Q,1),1)]);
+ p_equilibrium = mrdivide([zeros(1,size(Q,1)) 1],[Q ones(size(Q,1),1)]);
+
[Q_is_reversible, error_reversible] = isreversible(Q,p_equilibrium,1e-8); % Alessandro code for checking reversibility
display_with_flag([LOG_LVL2 'Equilibrium distribution found! Prob. of being in each possible state:'], flag_general_logs)
display_with_flag(p_equilibrium, flag_general_logs)
diff --git a/source/sfctm/generate_wlans_from_file.m b/source/sfctm/generate_wlan_from_file.m
similarity index 80%
rename from source/sfctm/generate_wlans_from_file.m
rename to source/sfctm/generate_wlan_from_file.m
index 4fc0f5d..42626dd 100644
--- a/source/sfctm/generate_wlans_from_file.m
+++ b/source/sfctm/generate_wlan_from_file.m
@@ -1,19 +1,24 @@
%%% ***********************************************************************
-%%% * A Tutorial on the Spatial Reuse Operation in IEEE 802.11ax: *
-%%% * Work Done, Challenges and Research Opportunities *
-%%% * Submission to ... *
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
%%% * Authors: *
%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
%%% * - Cristina Cano (ccanobs@uoc.edu) *
%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
-%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
-%%% * Copyright (C) 2017-2022, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
%%% * Repository: *
-%%% * bitbucket.org/fwilhelmi/overview_ieee80211ax_spatial_reuse/ *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
%%% ***********************************************************************
-function wlans = generate_wlans_from_file(filename, draw_map, ...
+function wlans = generate_wlan_from_file(filename, draw_map, ...
random_initial_conf, actions_channel, actions_cca, actions_tpc)
% GenerateNetwork3D - Generates a 3D network
% OUTPUT:
@@ -27,8 +32,8 @@
% * stas_position: way STAs are placed (1 - "random", 2 - "safe" or 3 - "exposed")
% * printMap: flag for calling DrawNetwork3D at the end
- 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
disp('Processing input CSV...')
input_data = load(filename);
diff --git a/source/sfctm/generate_wlans.m b/source/sfctm/generate_wlans.m
deleted file mode 100755
index e6f088f..0000000
--- a/source/sfctm/generate_wlans.m
+++ /dev/null
@@ -1,53 +0,0 @@
-%%% * Spatial-Flexible CTMN for WLANs *
-%%% * Author: Sergio Barrachina-Munoz (sergio.barrachina@upf.edu) *
-%%% * Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-%%% * GitHub repository: https://github.com/sergiobarra/SFCTMN *
-%%% * More info on https://www.upf.edu/en/web/sergiobarrachina *
-%%% *********************************************************************
-
-function [ wlans, num_wlans ] = generate_wlans( wlan_input_filename )
- %GENERATE_WLANS generate the wlan structures given a WLAN input .csv file
- % Input:
- % - wlan_input_filename: path of the .csv file
- % Output:
- % - wlans: WLANs structures
- % - num_channels_system: number of basic channels in the system
-
- load('constants.mat'); % Load constants into workspace
- load('system_conf.mat');
-
- % Generate wlan structures
- input_data = load(wlan_input_filename);
- wlans = []; % Array of structures containning wlans info
- num_wlans = length(input_data(:,1)); % Number of WLANs (APs)
- %num_channels_system = 0; % Number of channels in the system (is determined the most right channel used)
-
- for w = 1 : num_wlans
-
- wlans(w).code = input_data(w,INPUT_FIELD_IX_CODE); % Pick WLAN code
- wlans(w).primary = input_data(w,INPUT_FIELD_PRIMARY_CH); % Pick primary channel
- wlans(w).range = [input_data(w,INPUT_FIELD_LEFT_CH) input_data(w,INPUT_FIELD_RIGHT_CH)]; % pick range
- wlans(w).position_ap = [input_data(w,INPUT_FIELD_POS_AP_X) input_data(w,INPUT_FIELD_POS_AP_Y)...
- input_data(w,INPUT_FIELD_POS_AP_Z)]; % Pick AP positions
- wlans(w).position_sta = [input_data(w,INPUT_FIELD_POS_STA_X) input_data(w,INPUT_FIELD_POS_STA_Y)...
- input_data(w,INPUT_FIELD_POS_STA_Z)]; % Pick STA positions
- wlans(w).tx_power = input_data(w,INPUT_FIELD_TX_POWER); % Pick transmission power
- wlans(w).cca = input_data(w,INPUT_FIELD_CCA); % Pick CCA level
- %wlans(w).lambda = input_data(w,INPUT_FIELD_LAMBDA); % Pick lambda
- wlans(w).cw = input_data(w,INPUT_FIELD_CW); % Pick CW
- wlans(w).lambda = 1 / (T_symbol * (wlans(w).cw - 1)/2); % Compute lambda
- wlans(w).legacy = input_data(w,INPUT_FIELD_LEGACY); % legacy devices
- wlans(w).states = []; % Instantiate states for later use
- wlans(w).widths = []; % Instantiate acceptable widhts item for later use
- wlans(w).bandwidth = CHANNEL_WIDTH;
- % Rate for ONLY 1 channel: to be determined according to the SINR
- wlans(w).rate_one_channel = 0;
-
-% if(num_channels_system < wlans(w).range(2))
-% num_channels_system = wlans(w).range(2); % update number of channels present in the system
-% end
-
- end
-
-end
-
diff --git a/source/sfctm/get_channel_range.m b/source/sfctm/get_channel_range.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/get_probability_tx_in_n_channels.m b/source/sfctm/get_probability_tx_in_n_channels.m
old mode 100755
new mode 100644
index 540e94b..962d8ad
--- a/source/sfctm/get_probability_tx_in_n_channels.m
+++ b/source/sfctm/get_probability_tx_in_n_channels.m
@@ -26,8 +26,8 @@
% load('constants_ctmn.mat'); % Load constants into workspace
% load('system_conf.mat'); % Load constants into workspace
- 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
S_num_states = length(S_cell); % Number of feasible states
diff --git a/source/sfctm/get_throughput.m b/source/sfctm/get_throughput.m
index 53ef832..0312fd0 100644
--- a/source/sfctm/get_throughput.m
+++ b/source/sfctm/get_throughput.m
@@ -17,8 +17,8 @@
% - throughput: array whose element w is the average throughput of WLAN w.
% Load constants into workspace
- load('constants.mat');
- load('system_conf.mat');
+ load('constants_sfctmn_framework.mat');
+ load('configuration_system.mat');
% Initialize the array of throughput
throughput = zeros(num_wlans,1);
% Iterate for each state in feasible space S
@@ -32,27 +32,24 @@
% PSI's index of the backward transition origin state
[~, psi_ix] = find_state_in_set(S_cell{s_ix}, PSI_cell);
% If "wlan_ix" is active in state "psi_ix"
- if PSI_cell{psi_ix}(wlan_ix) > 0
+ if PSI_cell{psi_ix}(wlan_ix) > 0
interest_power = Interest_Power_PSI_cell{psi_ix}(wlan_ix);
sinr = SINR_cell{psi_ix}(wlan_ix);
-% disp(' + Checking if sinr < CAPTURE_EFFECT or interest_power < Power_Detection_PSI_cell:')
-% disp([' - sinr: ' num2str(sinr)])
-% disp([' - CAPTURE_EFFECT: ' num2str(CAPTURE_EFFECT)])
-% disp([' - interest_power: ' num2str(interest_power)])
-% disp([' - power detection: ' num2str(Power_Detection_PSI_cell{psi_ix}(wlan_ix))])
- if (sinr < CAPTURE_EFFECT) || (interest_power < Power_Detection_PSI_cell{psi_ix}(wlan_ix))
+ if (sinr < CAPTURE_EFFECT) || (interest_power < wlans(wlan_ix).cca) %Power_Detection_PSI_cell{psi_ix}(wlan_ix))
capture_effect_accomplished = false;
end
- tx_time = 0; % Set tx_time to 0 (safety operation)
+
+ if wlan_ix == 1 && PSI_cell{psi_ix}(wlan_ix) > 1
+ tx_power = apply_tx_power_restriction(Power_Detection_PSI_cell{psi_ix}(wlan_ix), ...
+ wlans(wlan_ix).tx_pwr_ref, TX_POWER_MAX, OBSS_PD_MIN, num_channels);
+ end
+
+ % Compute the tx time spent in "psi_ix"
+ [tx_time, limited_num_pack_agg] = SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
+ num_channels * CHANNEL_WIDTH_MHz, SINGLE_USER_SPATIAL_STREAMS, mcs_per_wlan{psi_ix}(wlan_ix), false);
+
% If the CE condition is accomplisehd, compute "mu" for state "psi_ix"
- if capture_effect_accomplished
- % Compute the tx time spent in "psi_ix"
- tx_time = SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
- num_channels * CHANNEL_WIDTH_MHz, SINGLE_USER_SPATIAL_STREAMS, mcs_per_wlan{psi_ix}(wlan_ix));
-% disp([' wlan_ix: ' num2str(wlan_ix)])
-% disp([' psi_ix: ' num2str(psi_ix)])
-% disp([' mcs: ' num2str(mcs_per_wlan{psi_ix}(wlan_ix))])
-% disp([' tx_time: ' num2str(tx_time)])
+ if capture_effect_accomplished
% Compute "mu" in psi_ix
mu = 1/tx_time;
else
@@ -60,14 +57,9 @@
mu = 0;
end
% Add the throughput of "psi_ix" to the total throughput of wlan "wlan_ix"
- throughput(wlan_ix) = throughput(wlan_ix) + (1 - PACKET_ERR_PROBABILITY) * NUM_PACKETS_AGGREGATED *...
- PACKET_LENGTH * mu * pi_s ./ 1E6;
-% disp([' - PACKET_ERR_PROBABILITY: ' num2str(PACKET_ERR_PROBABILITY)])
-% disp([' - NUM_PACKETS_AGGREGATED: ' num2str(NUM_PACKETS_AGGREGATED)])
-% disp([' - PACKET_LENGTH: ' num2str(PACKET_LENGTH)])
-% disp([' - mu: ' num2str(mu)])
-% disp([' - pi_s: ' num2str(pi_s)])
-% disp([' - throughput(wlan_ix): ' num2str(throughput(wlan_ix))])
+ throughput(wlan_ix) = throughput(wlan_ix) + ...
+ (1 - PACKET_ERR_PROBABILITY) * limited_num_pack_agg *...
+ PACKET_LENGTH * mu * pi_s ./ 1E6;
end
end
end
diff --git a/source/sfctm/identify_feasible_states_and_Q.m b/source/sfctm/identify_feasible_states_and_Q.m
old mode 100755
new mode 100644
index c0362cf..bbdd6ba
--- a/source/sfctm/identify_feasible_states_and_Q.m
+++ b/source/sfctm/identify_feasible_states_and_Q.m
@@ -8,7 +8,8 @@
function [ Q, S, S_cell, T_S, T_PSI, S_num_states, mcs_index_cell ] = ...
identify_feasible_states_and_Q( PSI_cell, Power_AP_PSI_cell, Power_Detection_PSI_cell, ...
- Individual_Power_AP_PSI_cell, num_channels_system, wlans, mcs_indexes, logs_algorithm_on )
+ Individual_Power_AP_PSI_cell, num_channels_system, wlans, mcs_indexes, ...
+ Interest_Power_PSI_cell, SINR_cell, logs_algorithm_on )
%IDENTIFY_FEASIBLE_STATES function for finding the feasible state space (S) and transition rate matrix (Q) of a
% given WLAN system taking the power sensed in the interest spectrum into consideration. This algorithm is an
% extension to allow non-fully overlapping networks of "Faridi, Azadeh, Boris Bellalta, and Alessandro Checco.
@@ -30,8 +31,8 @@
% - T_PSI: logical transition rates matrix in global space
% - S_num_states: number of feasible states
- load('constants.mat'); % Load constants into workspace
- load('system_conf.mat'); % Load system configuration
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
+ load('configuration_system.mat'); % Load system configuration
if logs_algorithm_on
disp(' ');
@@ -123,9 +124,30 @@
mcs_index = mcs_indexes{origin_psi_ix}(wlan_ix, 1);
mcs_index_cell{origin_psi_ix}(wlan_ix) = mcs_index;
num_ch_wlan_s = 1; % Number of channels used by WLAN wlan in current state s
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%% NEW
+ % Check if the transmission is successful or not
+ % (in order to limit the tx duration)
+ interest_power = Interest_Power_PSI_cell{origin_psi_ix}(wlan_ix);
+ sinr = SINR_cell{origin_psi_ix}(wlan_ix);
+ if (sinr < CAPTURE_EFFECT) || (interest_power < wlans(wlan_ix).cca)
+ % The transmission duration lasts until the CTS timeout
+ TimeoutFlag = true;
+ else
+ % The entire transmission duration is considered
+ TimeoutFlag = false;
+ end
+% disp(['Backward transition from ' num2str(origin_psi_ix) ' to ' num2str(destination_psi_ix)])
+% TimeoutFlag
+% interest_power
+% sinr
mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
- num_ch_wlan_s * CHANNEL_WIDTH_MHz,...
- SINGLE_USER_SPATIAL_STREAMS, mcs_index);
+ num_ch_wlan_s * CHANNEL_WIDTH_MHz, SINGLE_USER_SPATIAL_STREAMS, mcs_index, TimeoutFlag);
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
+% num_ch_wlan_s * CHANNEL_WIDTH_MHz,...
+% SINGLE_USER_SPATIAL_STREAMS, mcs_index);
% Update Q with the departure rate
Q(origin_s_ix, destination_s_ix) = mu_s;
% Indicate in T_PSI the type of transition
@@ -248,8 +270,29 @@
% Check if there is a backward transition between "psi_ix_aux" and "psi_ix"
if T_PSI(psi_ix_aux, psi_ix) == BACKWARD_TRANSITION
% Compute mu_s for lonely "SR" state to null state
- mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, num_ch_wlan_s * CHANNEL_WIDTH_MHz,...
- SINGLE_USER_SPATIAL_STREAMS, mcs_index_cell{psi_ix}(active_sr_wlan));
+
+ %%%%%%%%%%%%%%%%%%%%%%%%%% NEW
+ % Check if the transmission is successful or not
+ % (in order to limit the tx duration)
+ interest_power = Interest_Power_PSI_cell{psi_ix_aux}(active_sr_wlan);
+ sinr = SINR_cell{psi_ix_aux}(active_sr_wlan);
+ if (sinr < CAPTURE_EFFECT) || (interest_power < wlans(active_sr_wlan).cca)
+ % The transmission duration lasts until the CTS timeout
+ TimeoutFlag = true;
+ else
+ % The entire transmission duration is considered
+ TimeoutFlag = false;
+ end
+
+% disp(['Backward transition from ' num2str(psi_ix_aux) ' to ' num2str(psi_ix_aux)])
+
+ mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, ...
+ num_ch_wlan_s * CHANNEL_WIDTH_MHz, SINGLE_USER_SPATIAL_STREAMS, mcs_indexes{psi_ix}(active_sr_wlan, 1), TimeoutFlag);
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ %mu_s = 1 / SUtransmission80211ax(PACKET_LENGTH, NUM_PACKETS_AGGREGATED, num_ch_wlan_s * CHANNEL_WIDTH_MHz,...
+ % SINGLE_USER_SPATIAL_STREAMS, mcs_index_cell{psi_ix}(active_sr_wlan));
+
% Find state "psi_ix" in feasible space S
[~, origin_s_ix] = find_state_in_set(PSI_cell{psi_ix}, S_cell);
% Update mu_s in the Q matrix
diff --git a/source/sfctm/identify_global_states.m b/source/sfctm/identify_global_states.m
old mode 100755
new mode 100644
index a02108b..5fa9661
--- a/source/sfctm/identify_global_states.m
+++ b/source/sfctm/identify_global_states.m
@@ -19,7 +19,7 @@
% - num_global_states: number of global states
% - PSI: 3d matrix representing the global states
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
for wlan_ix = 1 : num_wlans
@@ -27,22 +27,118 @@
wlans(wlan_ix).states(1,:) = false(1, num_channels_system); % Instantiate first state as unactive
acceptable_widths = []; % Set of acceptable widths (determined by the channel access protocol)
- wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = true;
- wlans(wlan_ix).widths(end + 1) = 1;
+ switch access_protocol % Identify acceptable channel widths according to channel access protocol
+
+ % Any channel range of size 2^k, where k = 0 : log2(num_channels_system)
+ case ACCESS_PROTOCOL_LOG2
+
+ % Alessandro code
+ acceptable_widths = 2.^(0:log2(max_width));
+
+ for width_ix = 1 : numel(acceptable_widths) % for every acceptable channel width
+ width_aux = acceptable_widths(width_ix); % pick a width
+ for left_ch_ix = (wlans(wlan_ix).primary - width_aux + 1) : wlans(wlan_ix).primary
+ if ((left_ch_ix >= 1) && (left_ch_ix <= num_channels_system)...
+ && (left_ch_ix + width_aux - 1 <= num_channels_system)...
+ && (left_ch_ix >= wlans(wlan_ix).range(1))...
+ && (left_ch_ix + width_aux - 1 <= wlans(wlan_ix).range(2)))
+
+ wlans(wlan_ix).states(end + 1, left_ch_ix:(left_ch_ix + width_aux - 1)) = true;
+ wlans(wlan_ix).widths(end + 1) = width_aux;
+ end
+ end
+ end
+
+ % IEEE 802.11 channel access protocol. Channel ranges of size 2^k with some specific constraints.
+ case ACCESS_PROTOCOL_IEEE80211
+
+ acceptable_widths = 2.^(0:log2(max_width)); % Channels of size 2^k
+
+ for width_ix = 1 : numel(acceptable_widths) % For every acceptable channel width
- %%%%%%%%%%%%% SR OPERATION
- if wlans(wlan_ix).non_srg_activated
- wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = STATE_NONSRG_ACTIVATED;
- wlans(wlan_ix).widths(end + 1) = 1;
- end
+ width_aux = acceptable_widths(width_ix);
+
+ for left_ch_ix = (wlans(wlan_ix).primary - width_aux + 1) : wlans(wlan_ix).primary
+
+ if ((left_ch_ix >= 1) && (left_ch_ix <= num_channels_system)...
+ && (left_ch_ix + width_aux - 1 <= num_channels_system)...
+ && (left_ch_ix >= wlans(wlan_ix).range(1))...
+ && (left_ch_ix + width_aux - 1 <= wlans(wlan_ix).range(2)))
- if wlans(wlan_ix).non_srg_activated && wlans(wlan_ix).srg > 0
- % In case SRG is used, generate states for SRG OBSS PD
- wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = STATE_SRG_ACTIVATED;
- wlans(wlan_ix).widths(end + 1) = 1;
- end
- %%%%%%%%%%%%% SR OPERATION
+ candidate_range = left_ch_ix:(left_ch_ix + width_aux - 1);
+ num_channels_candidate = (left_ch_ix + width_aux - 1) - left_ch_ix + 1;
+ is_acceptable_candidate_range = true;
+
+ % Determine if candidate range complies with IEEE 802.11 channelization constraints
+ switch num_channels_candidate
+ case 1
+ % candidate range remains the same
+ case 2
+ if isequal(candidate_range, 2:3) || isequal(candidate_range, 4:5) ||...
+ isequal(candidate_range, 6:7)
+ is_acceptable_candidate_range = false;
+ end
+ case 4
+ if ~(isequal(candidate_range, 1:4) || isequal(candidate_range, 5:8))
+ is_acceptable_candidate_range = false;
+ end
+ case 8
+ % candidate range remains the same
+ otherwise
+ % unkown number of channels
+ error('Unkown number of channels')
+ end
+ if is_acceptable_candidate_range
+ wlans(wlan_ix).states(end + 1, left_ch_ix : (left_ch_ix + width_aux - 1)) = true;
+ wlans(wlan_ix).widths(end + 1) = width_aux;
+ end
+
+ end
+ end
+ end
+
+ % Any range of adjacent channels
+ case ACCESS_PROTOCOL_ADJACENT
+ acceptable_widths = 1 : max_width;
+
+ for width_ix = 1 : numel(acceptable_widths) % for every acceptable channel width
+
+ width_aux = acceptable_widths(width_ix); % pick a width
+
+ for left_ch_ix = (wlans(wlan_ix).primary - width_aux + 1) : wlans(wlan_ix).primary
+ if ((left_ch_ix >= 1) && (left_ch_ix <= num_channels_system)...
+ && (left_ch_ix + width_aux - 1 <= num_channels_system)...
+ && (left_ch_ix >= wlans(wlan_ix).range(1))...
+ && (left_ch_ix + width_aux - 1 <= wlans(wlan_ix).range(2)))
+ wlans(wlan_ix).states(end + 1, left_ch_ix:(left_ch_ix + width_aux - 1)) = true;
+ wlans(wlan_ix).widths(end + 1) = width_aux;
+ end
+ end
+ end
+
+ % Any range of adjacent channels
+ case ACCESS_PROTOCOL_SR_SINGLE_CHANNEL
+
+ wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = true;
+ wlans(wlan_ix).widths(end + 1) = 1;
+
+ %%%%%%%%%%%%% SR OPERATION
+ if wlans(wlan_ix).non_srg_activated
+ wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = STATE_NONSRG_ACTIVATED;
+ wlans(wlan_ix).widths(end + 1) = 1;
+ end
+
+ if wlans(wlan_ix).non_srg_activated && wlans(wlan_ix).srg > 0
+ % In case SRG is used, generate states for SRG OBSS PD
+ wlans(wlan_ix).states(end + 1, wlans(wlan_ix).primary) = STATE_SRG_ACTIVATED;
+ wlans(wlan_ix).widths(end + 1) = 1;
+ end
+ %%%%%%%%%%%%% SR OPERATION
+
+ otherwise
+ error('Protocol type unknown!');
+ end
end
% Use Alessandro's function for generating global states starting from WLAN own global states
diff --git a/source/sfctm/isreversible.m b/source/sfctm/isreversible.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/main_sfctmn.m b/source/sfctm/main_sfctmn.m
index d07809d..9049fe5 100755
--- a/source/sfctm/main_sfctmn.m
+++ b/source/sfctm/main_sfctmn.m
@@ -16,7 +16,7 @@
type 'sfctmn_header.txt'
%% FRAMEWORK CONFIGURATION
-constants_script
+constants_sfctmn_framework
if flag_save_console_logs
diary('console_logs.txt') % Save logs in a text file
@@ -34,45 +34,31 @@
% Framework constant variables
display_with_flag('- Loading constant variables...', flag_general_logs)
-load('constants.mat') % Execute constants_script.m script to store constants in the workspace
+load('constants_sfctmn_framework.mat') % Execute constants_script.m script to store constants in the workspace
display_with_flag([LOG_LVL3 'Constants loaded!'], flag_general_logs)
% System configuration
display_with_flag([LOG_LVL2 'Loading system configuration...'], flag_general_logs)
-system_conf % Execute system_conf.m script to store constants in the workspace
-load('system_conf.mat'); % Load constants into workspace
+configuration_system % Execute system_conf.m script to store constants in the workspace
+load('configuration_system.mat'); % Load constants into workspace
display_with_flag([LOG_LVL3 'System configuration loaded!'], flag_general_logs)
% Generate wlans
-input_file = "wlans_input.csv";
-wlans = generate_wlans_from_file(input_file, false, false, 1, [], []);
+input_file = "input_example_spatial_reuse.csv";
+wlans = generate_wlan_from_file(input_file, false, false, 1, [], []);
% Determine the number of WLANs
num_wlans = size(wlans, 2);
-% HARDCODING distance for convenience
-% AP ---- AP ---- AP
-% | | |
-% STA STA STA
-%
-if flag_hardcode_distances
- disp([LOG_LVL3 'HARDCODING DISTANCES FOR CONVENIENCE!'])
- distance_ap_sta = 7;
- distance_ap_ap = 30;
- for w = 1 : num_wlans
- wlans(w).position_ap = [((w - 1) * distance_ap_ap) 0 0];
- wlans(w).position_sta = wlans(w).position_ap + [0 -distance_ap_sta 0];
- end
- % END OF HARDCODING distance for convenience
-end
-[distance_ap_ap, distance_ap_sta] = compute_distance_nodes(wlans);
-
% Check input correctness
-disp([LOG_LVL3 'Checking input configuration...'])
-check_input_config(wlans);
-disp([LOG_LVL4 'WLANs input file processed successfully!'])
+if flag_input_checker
+ display_with_flag([LOG_LVL3 'Checking input configuration...'], flag_general_logs)
+ check_input_config(wlans);
+ display_with_flag([LOG_LVL4 'WLANs input file processed successfully!'], flag_general_logs)
+end
% SINR sensed in the STA in isolation (just considering ambient noise)
% - NOT USED
+%sinr_isolation = compute_sinr(powerRxStationFromAp, 0, NOISE_DBM);
display_wlans(wlans, flag_display_wlans, flag_plot_wlans, ...
flag_plot_ch_allocation, num_channels, path_loss_model, carrier_frequency);
@@ -103,16 +89,19 @@
%% Modulation and Coding Scheme
% Compute the MCS according to the SINR in isolation mode
-mcs_per_wlan_per_state = compute_mcs(Interest_Power_PSI_cell, num_channels);
+mcs_per_wlan_per_state = compute_mcs(PSI_cell, Interest_Power_PSI_cell, num_channels);
%% FEASIBLE STATES SPACE (S)
% Identify feasible states space (S) according to spatial and spectrum requirements.
display_with_flag(' ', flag_general_logs)
display_with_flag([LOG_LVL1 'Identifying feasible state space (S) and transition rate matrix (Q)...'], flag_general_logs)
[ Q, S, S_cell, Q_logical_S, Q_logical_PSI, S_num_states, new_mcs_per_wlan_per_state ] = identify_feasible_states_and_Q(...
- PSI_cell, Power_AP_PSI_cell, Power_Detection_PSI_cell, Individual_Power_AP_PSI_cell, num_channels, wlans, mcs_per_wlan_per_state, flag_logs_feasible_space);
+ PSI_cell, Power_AP_PSI_cell, Power_Detection_PSI_cell, Individual_Power_AP_PSI_cell, num_channels, wlans, mcs_per_wlan_per_state, ...
+ Interest_Power_PSI_cell, SINR_cell, flag_logs_feasible_space);
display_with_flag([LOG_LVL2 'Feasible state space (S) identified! There are ' num2str(S_num_states) ' feasible states.'], flag_general_logs)
+%Q
+
%% MARKOV CHAIN
% Solve Markov Chain from equilibrium distribution
display_with_flag(' ', flag_general_logs)
@@ -120,6 +109,7 @@
% Equilibrium distribution array (pi). Element s is the probability of being in state s.
% - The left null space of Q is equivalent to solve [pi] * Q = [0 0 ... 0 1]
+
p_equilibrium = mrdivide([zeros(1,size(Q,1)) 1],[Q ones(size(Q,1),1)]);
[Q_is_reversible, error_reversible] = isreversible(Q,p_equilibrium,1e-8); % Alessandro code for checking reversibility
@@ -137,7 +127,7 @@
throughput = get_throughput(wlans, num_wlans, p_equilibrium, S_cell, ...
PSI_cell, SINR_cell, new_mcs_per_wlan_per_state, Power_Detection_PSI_cell, Interest_Power_PSI_cell);
proportional_fairness = sum(log(throughput));
-display_with_flag([LOG_LVL2 'Throughput computed!'], flag_general_logs)
+display_with_flag([LOG_LVL2 'Trhoughput computed!'], flag_general_logs)
%% Save results
if flag_save_results
diff --git a/source/sfctm/plot_ctmc.m b/source/sfctm/plot_ctmc.m
old mode 100755
new mode 100644
index 26bbdc7..b0a7530
--- a/source/sfctm/plot_ctmc.m
+++ b/source/sfctm/plot_ctmc.m
@@ -16,7 +16,7 @@
% Output:
% - labels_ctmc: array of node labels
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
% Set font type
set(0,'defaultUicontrolFontName','Helvetica');
diff --git a/source/sfctm/plot_throughput.m b/source/sfctm/plot_throughput.m
old mode 100755
new mode 100644
index f849a55..97ec1dd
--- a/source/sfctm/plot_throughput.m
+++ b/source/sfctm/plot_throughput.m
@@ -11,7 +11,7 @@
% - throughput: array whose element w is the average throughput of WLAN w
% - num_wlans: number of WLANs in the system
- load('constants.mat'); % Load constants into workspace
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
figure
hold on
diff --git a/source/sfctm/setprod.m b/source/sfctm/setprod.m
old mode 100755
new mode 100644
diff --git a/source/sfctm/spatial_reuse_methods/apply_tx_power_restriction.m b/source/sfctm/spatial_reuse_methods/apply_tx_power_restriction.m
new file mode 100644
index 0000000..db6729a
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/apply_tx_power_restriction.m
@@ -0,0 +1,27 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function [ tx_power ] = apply_tx_power_restriction( obss_pd, tx_pwr_ref, ...
+ TX_POWER_MAX, OBSS_PD_MIN, num_channels )
+
+ tx_power = min(TX_POWER_MAX , tx_pwr_ref ...
+ - (obss_pd - OBSS_PD_MIN) - 3 * (num_channels - 1));
+
+end
\ No newline at end of file
diff --git a/source/sfctm/spatial_reuse_methods/check_transition_feasibility_spatial_reuse.m b/source/sfctm/spatial_reuse_methods/check_transition_feasibility_spatial_reuse.m
new file mode 100644
index 0000000..3390a5c
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/check_transition_feasibility_spatial_reuse.m
@@ -0,0 +1,78 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function [ feasible ] = check_transition_feasibility_spatial_reuse( wlans, PSI_cell, ...
+ Power_PSI_cell, Power_Detection_PSI_cell, source_state_ix, dest_state_ix, wlan_ix )
+
+ %CHECK_STATE_FEASIBILITY checks if a given state is feasible or not
+ % - wlans: array of structures with wlans info
+ % - PSI_cell:
+ % - Power_PSI_cell:
+ % - Power_Detection_PSI_cell:
+ % - source_state_ix: index of the source state
+ % - dest_state_ix: index of the destination state
+ % - wlan_ix: index of the wlan attempting to access to state "state_ix"
+ % Output:
+ % - feasible: boolean indicating that a state is feasible (1) or not (0)
+
+ feasible = false;
+
+ % Find active WLANs in state "state_ix"
+ active_wlans = find(PSI_cell{source_state_ix}>0);
+ pd_thresholds = zeros(1,4); % In order to store all the possible PD threshold associated to ongoing transmissions
+ % If there is more than one active WLAN, check if the dest. state is feasible
+ if active_wlans >= 1
+ % Iterate for each active wlan different than "wlan_ix"
+ for ix = 1 : size(active_wlans)
+ if wlan_ix ~= active_wlans(ix)
+ % In case SRG is activated
+ if wlans(wlan_ix).srg >= 0 && wlans(active_wlans(ix)).srg >= 0
+ % Same SRG case
+ if wlans(wlan_ix).srg == wlans(active_wlans(ix)).srg
+ pd_thresholds(3) = wlans(wlan_ix).srg_obss_pd;
+ % Different SRG case
+ else
+ pd_thresholds(4) = wlans(wlan_ix).non_srg_obss_pd;
+ end
+ % In case BSS color is activated, but not SRG
+ elseif wlans(wlan_ix).bss_color >= 0 && wlans(active_wlans(ix)).bss_color >= 0
+ % Same BSS color case
+ if wlans(wlan_ix).bss_color == wlans(active_wlans(ix)).bss_color
+ pd_thresholds(1) = wlans(wlan_ix).cca;
+ % Different BSS color case
+ else
+ pd_thresholds(2) = wlans(wlan_ix).non_srg_obss_pd;
+ end
+ % Legacy capabilities
+ else
+ pd_thresholds(1) = wlans(wlan_ix).cca;
+ end
+ end
+ end
+ % Check if the PD condition is accomplished for all the ongoing transmissions (use the minimum of all the gathered thresholds)
+ if Power_Detection_PSI_cell{dest_state_ix}(wlan_ix) <= min(pd_thresholds) && ...
+ Power_PSI_cell{source_state_ix}(wlan_ix) < Power_Detection_PSI_cell{dest_state_ix}(wlan_ix)
+ feasible = true;
+ end
+ else
+ feasible = true;
+ end
+
+end
\ No newline at end of file
diff --git a/source/sfctm/spatial_reuse_methods/check_wlans_types.m b/source/sfctm/spatial_reuse_methods/check_wlans_types.m
new file mode 100644
index 0000000..92faba8
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/check_wlans_types.m
@@ -0,0 +1,50 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function [ wlans_types ] = check_wlans_types( wlans )
+ %CHECK_WLAN_TYPE checks if the type of wlan transmitting in a given state
+ % Input:
+ % - wlans: array of structures with wlans info
+ % - wlan_ix: index of the potentially inteferred WLAN
+ % - neighboring_wlan_ix: index of the potentially interfering WLAN
+ % Output:
+ % - wlan_type: integer indicating the type of WLAN
+
+ %load('constants_sfctmn_framework.mat'); % Load constants into workspace
+
+ wlans_types = -1 * ones(size(wlans, 2), size(wlans, 2));
+
+ for i = 1 : size(wlans, 2)
+ for j = 1 : size(wlans, 2)
+ if i ~= j
+ if wlans(i).non_srg_activated
+ if wlans(j).srg == wlans(i).srg
+ wlans_types(i, j) = 3;
+ elseif wlans(j).srg ~= wlans(i).srg
+ wlans_types(i, j) = 2;
+ end
+ else
+ wlans_types(i, j) = 1;
+ end
+ end
+ end
+ end
+
+end
\ No newline at end of file
diff --git a/source/sfctm/spatial_reuse_methods/determine_power_detection_threshold.m b/source/sfctm/spatial_reuse_methods/determine_power_detection_threshold.m
new file mode 100644
index 0000000..88a7ede
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/determine_power_detection_threshold.m
@@ -0,0 +1,69 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function [ power_detection_threshold ] = determine_power_detection_threshold...
+ ( PSI_cell, wlans, state_ix, type_neighboring_wlans, wlan_ix )
+ %CHECK_WLAN_TYPE checks if the type of wlan transmitting in a given state
+ % Input:
+ % - wlans: array of structures with wlans info
+ % - wlan_ix: index of the potentially inteferred WLAN
+ % - neighboring_wlan_ix: index of the potentially interfering WLAN
+ % Output:
+ % - wlan_type: integer indicating the type of WLAN
+
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
+
+ LEGACY = false;
+ INTER_BSS = false;
+ NON_SRG = false;
+ SRG = false;
+ for i = 1 : size(wlans, 2)
+ if i ~= wlan_ix && PSI_cell{state_ix}(i) == 1
+ if type_neighboring_wlans(i) == WLAN_TYPE_LEGACY
+ LEGACY = true;
+ elseif type_neighboring_wlans(i) == WLAN_TYPE_INTER_BSS
+ INTER_BSS = true;
+ elseif type_neighboring_wlans(i) == WLAN_TYPE_NON_SRG
+ NON_SRG = true;
+ elseif type_neighboring_wlans(i) == WLAN_TYPE_SRG
+ SRG = true;
+ end
+ end
+ end
+
+ if ~LEGACY && INTER_BSS
+ power_detection_threshold = wlans(wlan_ix).obss_pd;
+ %disp([' - INTER-BSS TRANSMISSION DETECTED in STATE ' num2str(state_ix)])
+ elseif ~LEGACY && ~INTER_BSS && NON_SRG
+ power_detection_threshold = wlans(wlan_ix).non_srg_obss_pd;
+ %disp([' - NON-SRG TRANSMISSION DETECTED in STATE ' num2str(state_ix)])
+ elseif ~LEGACY && ~INTER_BSS && ~NON_SRG && SRG
+ power_detection_threshold = wlans(wlan_ix).srg_obss_pd;
+ %disp([' - SRG TRANSMISSION DETECTED in STATE ' num2str(state_ix)])
+ elseif LEGACY
+ power_detection_threshold = wlans(wlan_ix).cca;
+ %disp([' - LEGACY TRANSMISSION DETECTED in STATE ' num2str(state_ix)])
+ else
+ power_detection_threshold = wlans(wlan_ix).cca;
+ %disp([' - NO TRANSMISSION DETECTED in STATE ' num2str(state_ix)])
+ end
+
+end
+
diff --git a/source/sfctm/spatial_reuse_methods/identify_neighboring_wlans.m b/source/sfctm/spatial_reuse_methods/identify_neighboring_wlans.m
new file mode 100644
index 0000000..5ed282c
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/identify_neighboring_wlans.m
@@ -0,0 +1,43 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function [ type_neighboring_wlans ] = identify_neighboring_wlans( wlans, wlan_ix )
+ %CHECK_WLAN_TYPE checks if the type of wlan transmitting in a given state
+ % Input:
+ % - wlans: array of structures with wlans info
+ % - wlan_ix: index of the potentially inteferred WLAN
+ % - neighboring_wlan_ix: index of the potentially interfering WLAN
+ % Output:
+ % - wlan_type: integer indicating the type of WLAN
+
+ load('constants_sfctmn_framework.mat'); % Load constants into workspace
+
+ type_neighboring_wlans = zeros(1, size(wlans, 2));
+ % Iterate for each potential OBSS in the possible state
+ for i = 1 : size(wlans, 2)
+ if i ~= wlan_ix
+ type_neighboring_wlans(i) = check_wlan_type(wlans, wlan_ix, i);
+ else
+ type_neighboring_wlans(i) = -1; % To indicate that it is the same WLAN
+ end
+ end
+
+end
+
diff --git a/source/sfctm/spatial_reuse_methods/process_psi_forward_sr.m b/source/sfctm/spatial_reuse_methods/process_psi_forward_sr.m
new file mode 100644
index 0000000..ab5b84c
--- /dev/null
+++ b/source/sfctm/spatial_reuse_methods/process_psi_forward_sr.m
@@ -0,0 +1,125 @@
+%%% ***********************************************************************
+%%% * *
+%%% * Spatial Reuse Operation in IEEE 802.11ax: *
+%%% * Analysis, Challenges and Research Opportunities *
+%%% * *
+%%% * Submission to IEEE Surveys & Tutorials *
+%%% * *
+%%% * Authors: *
+%%% * - Francesc Wilhelmi (francisco.wilhelmi@upf.edu) *
+%%% * - Sergio Barrachina-Muñoz (sergio.barrachina@upf.edu) *
+%%% * - Boris Bellalta (boris.bellalta@upf.edu) *
+%%% * - Cristina Cano (ccanobs@uoc.edu) *
+%%% * - Ioannis Selinis (ioannis.selinis@surrey.ac.uk) *
+%%% * *
+%%% * Copyright (C) 2019-2024, and GNU GPLd, by Francesc Wilhelmi *
+%%% * *
+%%% * Repository: *
+%%% * https://github.com/fwilhelmi/tutorial_11ax_spatial_reuse *
+%%% ***********************************************************************
+
+function new_psi_forward = process_psi_forward_sr(psi_forward, PSI_cell, current_state_ix, wlans, wlan_ix, wlans_types )
+%PROCESS_PSI_FORWARD_SPATIAL_REUSE Summary of this function goes here
+% Detailed explanation goes here
+
+ new_psi_forward = [];
+
+ num_possible_forward_states = size(psi_forward, 2);
+
+% if num_possible_forward_states == 1
+%
+%
+% else
+
+% disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
+% disp('Check forward states')
+ for ix = 1 : num_possible_forward_states % For each possible forward state
+
+ %disp([' * state ' num2str(possible_forward_states(ix))])
+
+ % Possible forward state
+ psi_possible_ix = psi_forward(ix);
+ state_feasible = false;
+
+ %disp(['* psi_possible_ix ' num2str(psi_possible_ix)])
+ %PSI_cell{current_state_ix}
+ %PSI_cell{psi_possible_ix}
+
+ %disp(['* wlans_types ' num2str(wlans_types(wlan_ix, :))])
+
+ % Difference between current state and feasible state
+ difference_between_states = PSI_cell{psi_possible_ix} - PSI_cell{current_state_ix};
+ new_wlan_type = sum(difference_between_states);
+
+ wlans_aux = [];
+ for w_ix = 1 : size(wlans, 2)
+ if PSI_cell{current_state_ix}(w_ix) > 0 && w_ix ~= wlan_ix
+ wlans_aux = [wlans_aux w_ix];
+ end
+ end
+
+ % First check
+ %disp([' - wlans_types = ' num2str(wlans_types(wlan_ix, :)) ' / new_wlan_type = ' num2str(new_wlan_type)])
+
+ if sum(wlans_types(wlan_ix, :) == new_wlan_type) > 0
+ %disp(' + First check passed!')
+ % Second check
+ %disp([' - wlans_aux = ' num2str(wlans_aux) ' / new_wlan_type = ' num2str(new_wlan_type)])
+ if sum(wlans_types(wlan_ix, wlans_aux) == new_wlan_type) > 0
+ % disp(' + Second check passed!')
+ if PSI_cell{psi_possible_ix}(wlans_aux) ~= PSI_cell{psi_possible_ix}(wlan_ix)
+ % disp(' + Third check passed!')
+ state_feasible = true;
+ end
+ end
+ end
+
+
+ % if wlans_types(new_wlan_ix) == new_wlan_type || sum(PSI_cell{psi_possible_ix} > 1) == 0
+ % state_feasible = true;
+ % end
+ %
+ % % Second check
+ % new_state_transmitting_wlans = size(find(PSI_cell{psi_possible_ix} > 0), 1);% == size(wlans,2) - 1
+ % if new_state_transmitting_wlans == 1 && sum(wlans_types == new_wlan_type) > 0
+ % state_feasible = true;
+ % end
+ %
+ % if new_state_transmitting_wlans > 0
+ % [~, new_wlan_ix_aux] = find(PSI_cell{current_state_ix} > 0);
+ % if wlans_types(new_wlan_ix_aux) == new_wlan_type
+ % state_feasible = true;
+ % end
+ % end
+ %
+ % % %if new_state_transmitting_wlans == 1
+ % if sum(wlans_types == new_wlan_type) > 0
+ % if PSI_cell{psi_possible_ix}(wlan_ix) == new_wlan_type
+ % state_feasible = true;
+ % end
+ % end
+
+ % Third check
+
+
+ % disp('===================')
+ % PSI_cell{current_state_ix}
+ % PSI_cell{psi_possible_ix}
+ % PSI_cell{psi_possible_ix} - PSI_cell{current_state_ix}
+ % wlan_ix
+ % PSI_cell{psi_possible_ix}(wlan_ix)
+ % wlans_types
+ % new_wlan_type
+ % new_wlan_ix
+ % state_feasible
+ % disp('===================')
+
+
+ if state_feasible
+ new_psi_forward = [new_psi_forward psi_possible_ix];
+ end
+
+ end
+% end
+
+end
\ No newline at end of file
diff --git a/source/sfctm/system_conf.m b/source/sfctm/system_conf.m
deleted file mode 100755
index ab80a6b..0000000
--- a/source/sfctm/system_conf.m
+++ /dev/null
@@ -1,26 +0,0 @@
-%%% *********************************************************************
-%%% * Spatial-Flexible CTMN for WLANs *
-%%% * Author: Sergio Barrachina-Munoz (sergio.barrachina@upf.edu) *
-%%% * Copyright (C) 2017-2022, and GNU GPLd, by Sergio Barrachina-Munoz *
-%%% * GitHub repository: https://github.com/sergiobarra/SFCTMN *
-%%% * More info on https://www.upf.edu/en/web/sergiobarrachina *
-%%% *********************************************************************
-
-%%% File description: script for generating the system configuration
-
-path_loss_model = PATH_LOSS_AX_RESIDENTIAL; % Path loss model index
-access_protocol_type = ACCESS_PROTOCOL_IEEE80211; % 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;
-SINGLE_USER_SPATIAL_STREAMS = 1;
-
-% DSA policy type (SFCTMN)
-dsa_policy_type = DSA_POLICY_ONLY_MAX;
-num_channels = 1;
-
-CW_DEFAULT = 16;
-
-save('system_conf.mat'); % Save system configuration into current folder
-disp('System configuration saved in file system_conf.mat')
\ No newline at end of file
diff --git a/system_conf.mat b/system_conf.mat
deleted file mode 100644
index 69a492d..0000000
Binary files a/system_conf.mat and /dev/null differ