diff --git a/lab_4/lab_4.m b/lab_4/lab_4.m index 798d09c..c2eebb1 100644 --- a/lab_4/lab_4.m +++ b/lab_4/lab_4.m @@ -1,12 +1,13 @@ -% this code is in no manner clean +% this code is in no manner clean, much code copy because I was lazy % use these fields to select the task that should be calculated -do_task1 = false; -do_task2 = true; -do_task3_1 = true; -do_task3_2 = true; -do_task3_2_simple_calc = true; -do_task4 = true; +do_task1 = true; +do_task2 = false; +do_task3_1 = false; +do_task3_2 = false; +do_task3_2_simple_calc = false; +do_task4_1 = true; +do_task4_2 = true; carrier_frequency = 2.4e9; wifi_be_subcarrier_spacing = 78.125e3; @@ -42,6 +43,14 @@ if do_task1 end if do_task2 || do_task3_1 + if do_task2 && do_task3_1 + task2ProgressLabel = "Task 2 / Task 3.1"; + elseif do_task3_1 + task2ProgressLabel = "Task 3.1"; + else + task2ProgressLabel = "Task 2"; + end + use_pilot_tracking = false; task2; results_apep4000_npt = results(apep_values == 4000, :); @@ -49,6 +58,8 @@ if do_task2 || do_task3_1 use_pilot_tracking = true; task2; results_apep4000_pt = results(apep_values == 4000, :); + + clear task2ProgressLabel; end if do_task3_1 @@ -92,7 +103,11 @@ if do_task3_2_simple_calc end end -if do_task4 +if do_task4_1 use_t1_as_t4 = true; task1; end + +if do_task4_2 + task4; +end diff --git a/lab_4/task1.m b/lab_4/task1.m index 5770947..9615a45 100644 --- a/lab_4/task1.m +++ b/lab_4/task1.m @@ -1,7 +1,9 @@ if use_t1_as_t4 mcs_values_t1 = mcs_values; + progressTitle = "Task 4.1"; else mcs_values_t1 = [2]; + progressTitle = "Task 1"; end [cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = ... @@ -25,12 +27,13 @@ packetCounts = zeros(numel(mcs_values_t1), numel(snrs)); errorRates = zeros(numel(mcs_values_t1), numel(snrs)); cfrMagnitudesBySnr = cell(numel(mcs_values_t1), numel(snrs)); -f = waitbar(0, "Starting"); +progressStartText = "Starting MCS sweep"; +f = waitbar(0, progressStartText, "Name", progressTitle); progressTotal = numel(mcs_values_t1) * numel(snrs); progressQueue = parallel.pool.DataQueue; -parfor_waitbar(f, progressTotal, "Starting MCS sweep", true); +parfor_waitbar(f, progressTotal, progressStartText, true); progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false)); for imcs = 1 : numel(mcs_values_t1) diff --git a/lab_4/task2.m b/lab_4/task2.m index 12ce923..580f1cc 100644 --- a/lab_4/task2.m +++ b/lab_4/task2.m @@ -3,11 +3,19 @@ apep_values = [250 1000 4000 8000 12000]; results = zeros(numel(apep_values), numel(snrs)); -f = waitbar(0, "Starting APEP sweep"); +if exist('task2ProgressLabel', 'var') + taskLabel = task2ProgressLabel; +else + taskLabel = "Task 2"; +end + +progressTitle = taskLabel; +progressStartText = "Starting APEP sweep"; +f = waitbar(0, progressStartText, "Name", progressTitle); progressTotal = numel(apep_values) * numel(snrs); progressQueue = parallel.pool.DataQueue; -parfor_waitbar(f, progressTotal, "Starting APEP sweep", true); +parfor_waitbar(f, progressTotal, progressStartText, true); progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false)); for apep_idx = 1 : numel(apep_values) diff --git a/lab_4/task3.m b/lab_4/task3.m index de9d0a8..f76c2ff 100644 --- a/lab_4/task3.m +++ b/lab_4/task3.m @@ -3,11 +3,13 @@ carrier_frequencies = [1e9 2.4e9 5e9 5.8e9 6e9 12e9 24e9 60e9]; results = zeros(numel(carrier_frequencies), numel(snrs)); -f = waitbar(0, "Starting carrier frequency sweep"); +progressTitle = "Task 3.2"; +progressStartText = "Starting carrier frequency sweep"; +f = waitbar(0, progressStartText, "Name", progressTitle); progressTotal = numel(carrier_frequencies) * numel(snrs); progressQueue = parallel.pool.DataQueue; -parfor_waitbar(f, progressTotal, "Starting carrier frequency sweep", true); +parfor_waitbar(f, progressTotal, progressStartText, true); progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false)); for f_idx = 1 : numel(carrier_frequencies) diff --git a/lab_4/task4.m b/lab_4/task4.m new file mode 100644 index 0000000..64b0810 --- /dev/null +++ b/lab_4/task4.m @@ -0,0 +1,49 @@ +bandwidth_values = [20 40 80 160 320]; +mcs_task4 = 3; + +results = zeros(numel(bandwidth_values), numel(snrs)); +chanBWs = strings(1, numel(bandwidth_values)); + +progressTitle = "Task 4.2"; +progressStartText = "Starting bandwidth sweep"; +f = waitbar(0, progressStartText, "Name", progressTitle); +progressTotal = numel(bandwidth_values) * numel(snrs); +progressQueue = parallel.pool.DataQueue; + +parfor_waitbar(f, progressTotal, progressStartText, true); +progressListener = afterEach(progressQueue, @(info) parfor_waitbar(f, progressTotal, info, false)); + +for bandwidth_idx = 1 : numel(bandwidth_values) + currentBandwidth = bandwidth_values(bandwidth_idx); + [cfgEHT, simParameters, channel, chInfo, maxChDelay, satelliteDopplerShift, chanBW] = create_baseline_configuration(ntn_tdl_delay_profiles(3), currentBandwidth, false, "None", carrier_frequency, 0, 0, leo_altitude, random_stream, seed, tx_antenna_count, rx_antenna_count, apep); + + cfgEHT.User{1}.MCS = mcs_task4; + chanBWs(bandwidth_idx) = string(chanBW); + + parfor snr_idx = 1 : length(snrs) + local_channel = clone(channel); + [errorCount, packetCount, cfrMagnitudes] = simulateTransmission(cfgEHT, local_channel, maxChDelay, snrs(snr_idx), packets_per_snr, maxNumErrors, simParameters, chanBW, snr_idx, elevationAngles); + results(bandwidth_idx, snr_idx) = errorCount / packetCount; + send(progressQueue, sprintf("%s | SNR %.1f dB", chanBW, snrs(snr_idx))); + end +end + +delete(progressListener); +if ishandle(f) + close(f); +end + +markers = 'ox*sd^v> + +Qt SVG Document +MATLAB, The MathWorks, Inc. Version 26.1.0.3251617 R2026a Update 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 + + + +5 + + + +10 + + + +15 + + + +20 + + + +25 + + + +30 + + + +35 + + + +SNR (dB) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +10 + + + +-3 + + + +10 + + + +-2 + + + +10 + + + +-1 + + + +10 + + + +0 + + + +PER + + + +PER over SNR for bandwidth sweep, NTN-TDL-C, MCS 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CBW20 + + + +CBW40 + + + +CBW80 + + + +CBW160 + + + +CBW320 + + + + + + +